如官方 platforms 中的示例一样,在从 core 导出 Vue 核心代码后,还要再经过平台的加工,比如 weex
// install platform specific utilsVue.config.mustUseProp = mustUsePropVue.config.isReservedTag = isReservedTagVue.config.isRuntimeComponent = isRuntimeComponentVue.config.isUnknownElement = isUnknownElement// install platform runtime directives and componentsVue.options.directives = platformDirectivesVue.options.components = platformComponents// install platform patch functionVue.prototype.__patch__ = patch// wrap mountVue.prototype.$mount = function (el?: any,hydrating?: boolean): Component {return mountComponent(this,el && query(el, this.$document),hydrating)}
- 将
config中与平台相关的内容重新配置 - 添加平台特有的公共
options - 将
__patch__改为平台的 patch 函数 - 安装平台的
$mount函数
除去 core 部分是多平台通用的,其他都需要平台专门编写,最主要的就是与真实视图相关联的那一层,比如 $mount、patch 等
