Skip to content

Commit

Permalink
refactor(mp-alipay): 优化 options 选项添加逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
Otto-J authored and zhetengbiji committed May 17, 2024
1 parent bfac726 commit 4d9c457
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/platforms/mp-alipay/runtime/wrapper/component-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ function initVm (VueComponent) {
mpInstance: this
})

if (options.parent) { // 父组件已经初始化,直接初始化子,否则放到父组件的 didMount 中处理
if (options.parent) {
// 父组件已经初始化,直接初始化子,否则放到父组件的 didMount 中处理
// 初始化 vue 实例
this.$vm = new VueComponent(options)
handleRef.call(options.parent.$scope, this)
Expand Down Expand Up @@ -119,7 +120,8 @@ export default function parseComponent (vueComponentOptions, needVueOptions) {
data: initData(vueOptions, Vue.prototype),
props,
didMount () {
if (my.dd) { // 钉钉小程序底层基础库有 bug,组件嵌套使用时,在 didMount 中无法及时调用 props 中的方法
if (my.dd) {
// 钉钉小程序底层基础库有 bug,组件嵌套使用时,在 didMount 中无法及时调用 props 中的方法
setTimeout(() => {
initVm.call(this, VueComponent)
}, 4)
Expand All @@ -144,9 +146,11 @@ export default function parseComponent (vueComponentOptions, needVueOptions) {
__l: handleLink,
__w: handleWrap,
triggerEvent
},
// add
options: vueOptions.options || {}
}
}

if (vueOptions.options) {
componentOptions.options = vueOptions.options
}

if (isComponent2) {
Expand Down

0 comments on commit 4d9c457

Please sign in to comment.