提交 42e78dd3 编写于 作者: Q qiang

fix(mp): 修复新版作用域插槽编译模式嵌套自定义组件不显示的问题 question/126058

上级 224116fb
......@@ -196,6 +196,14 @@ describe('mp:compiler-mp-weixin', () => {
scopedSlotsCompiler: 'augmented'
}
)
assertCodegen(
'<my-component1><my-component2><template v-slot="{item}">{{getValue(item)}}<template></my-component2></my-component1>',
'<my-component1 vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[\'default\']}}"><my-component2 vue-id="{{(\'551070e6-2\')+\',\'+(\'551070e6-1\')}}" bind:__l="__l" vue-slots="{{[\'default\']}}"><block><block wx:if="{{$root.m0}}">{{$root.m1}}</block></block></my-component2></my-component1>',
'with(this){var m0=$hasScopedSlotsParams("551070e6-2");var m1=m0?getValue($getScopedSlotsParams("551070e6-2","default","item")):null;$mp.data=Object.assign({},{$root:{m0:m0,m1:m1}})}',
{
scopedSlotsCompiler: 'augmented'
}
)
assertCodegen(
'<view><slot :item="item"><slot></view>',
'<view><block wx:if="{{$slots.default}}"><slot></slot></block><block wx:else><slot></slot></block></view>',
......
......@@ -74,11 +74,14 @@ function initScopedSlotsParams () {
}
Vue.prototype.$setScopedSlotsParams = function (name, value) {
const vueId = this.$options.propsData.vueId
const object = center[vueId] = center[vueId] || {}
object[name] = value
if (parents[vueId]) {
parents[vueId].$forceUpdate()
const vueIds = this.$options.propsData.vueId
if (vueIds) {
const vueId = vueIds.split(',')[0]
const object = center[vueId] = center[vueId] || {}
object[name] = value
if (parents[vueId]) {
parents[vueId].$forceUpdate()
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册