提交 2f167d42 编写于 作者: fxy060608's avatar fxy060608

feat(runtime): 优化 mp 性能

上级 6aa31ebd
...@@ -617,6 +617,9 @@ function initVueComponent (mpInstace, VueComponent, extraOptions = {}) { ...@@ -617,6 +617,9 @@ function initVueComponent (mpInstace, VueComponent, extraOptions = {}) {
}); });
mpInstace.$vm.$scopedSlots = mpInstace.$vm.$slots = $slots; mpInstace.$vm.$scopedSlots = mpInstace.$vm.$slots = $slots;
} }
// 性能优先,mount 提前到 attached 中,保证组件首次渲染数据被合并
// 导致与标准 Vue 的差异,data 和 computed 中不能使用$parent,provide等组件属性
mpInstace.$vm.$mount();
} }
function createComponent (vueOptions) { function createComponent (vueOptions) {
...@@ -641,9 +644,9 @@ function createComponent (vueOptions) { ...@@ -641,9 +644,9 @@ function createComponent (vueOptions) {
initVueComponent(this, VueComponent); // 目前发现部分情况小程序 attached 不触发 initVueComponent(this, VueComponent); // 目前发现部分情况小程序 attached 不触发
triggerLink(this); // 处理 parent,children triggerLink(this); // 处理 parent,children
// 初始化渲染数据(需要等 parent,inject 都初始化完成,否则可以放到 attached 里边初始化渲染) // 补充生命周期
this.$vm.__call_hook('created'); this.$vm.__call_hook('created');
this.$vm.$mount(); this.$vm.__call_hook('beforeMount');
this.$vm._isMounted = true; this.$vm._isMounted = true;
this.$vm.__call_hook('mounted'); this.$vm.__call_hook('mounted');
this.$vm.__call_hook('onReady'); this.$vm.__call_hook('onReady');
......
{ {
"name": "@dcloudio/uni-mp-weixin", "name": "@dcloudio/uni-mp-weixin",
"version": "0.0.912", "version": "0.0.913",
"description": "uni-app mp-weixin", "description": "uni-app mp-weixin",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -33,6 +33,9 @@ function initVueComponent (mpInstace, VueComponent, extraOptions = {}) { ...@@ -33,6 +33,9 @@ function initVueComponent (mpInstace, VueComponent, extraOptions = {}) {
}) })
mpInstace.$vm.$scopedSlots = mpInstace.$vm.$slots = $slots mpInstace.$vm.$scopedSlots = mpInstace.$vm.$slots = $slots
} }
// 性能优先,mount 提前到 attached 中,保证组件首次渲染数据被合并
// 导致与标准 Vue 的差异,data 和 computed 中不能使用$parent,provide等组件属性
mpInstace.$vm.$mount()
} }
export function createComponent (vueOptions) { export function createComponent (vueOptions) {
...@@ -57,9 +60,9 @@ export function createComponent (vueOptions) { ...@@ -57,9 +60,9 @@ export function createComponent (vueOptions) {
initVueComponent(this, VueComponent) // 目前发现部分情况小程序 attached 不触发 initVueComponent(this, VueComponent) // 目前发现部分情况小程序 attached 不触发
triggerLink(this) // 处理 parent,children triggerLink(this) // 处理 parent,children
// 初始化渲染数据(需要等 parent,inject 都初始化完成,否则可以放到 attached 里边初始化渲染) // 补充生命周期
this.$vm.__call_hook('created') this.$vm.__call_hook('created')
this.$vm.$mount() this.$vm.__call_hook('beforeMount')
this.$vm._isMounted = true this.$vm._isMounted = true
this.$vm.__call_hook('mounted') this.$vm.__call_hook('mounted')
this.$vm.__call_hook('onReady') this.$vm.__call_hook('onReady')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册