如官方 platforms 中的示例一样,在从 core 导出 Vue 核心代码后,还要再经过平台的加工,比如 weex

    1. // install platform specific utils
    2. Vue.config.mustUseProp = mustUseProp
    3. Vue.config.isReservedTag = isReservedTag
    4. Vue.config.isRuntimeComponent = isRuntimeComponent
    5. Vue.config.isUnknownElement = isUnknownElement
    6. // install platform runtime directives and components
    7. Vue.options.directives = platformDirectives
    8. Vue.options.components = platformComponents
    9. // install platform patch function
    10. Vue.prototype.__patch__ = patch
    11. // wrap mount
    12. Vue.prototype.$mount = function (
    13. el?: any,
    14. hydrating?: boolean
    15. ): Component {
    16. return mountComponent(
    17. this,
    18. el && query(el, this.$document),
    19. hydrating
    20. )
    21. }
    1. config 中与平台相关的内容重新配置
    2. 添加平台特有的公共 options
    3. __patch__ 改为平台的 patch 函数
    4. 安装平台的 $mount 函数

    除去 core 部分是多平台通用的,其他都需要平台专门编写,最主要的就是与真实视图相关联的那一层,比如 $mountpatch