提交 148278b1 编写于 作者: Q qiang

fix(mp): scopedSlotsCompiler force augmented

上级 d0a3505c
......@@ -142,6 +142,14 @@ describe('mp:compiler-mp-weixin', () => {
scopedSlotsCompiler: 'augmented'
}
)
assertCodegen(
'<my-component><template v-slot="{item}">{{item}}<template></my-component>',
'<my-component vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[\'default\']}}"><block><block wx:if="{{$root.m0}}">{{$root.m1}}</block></block></my-component>',
'with(this){var m0=$hasScopedSlotsParams("551070e6-1");var m1=m0?$getScopedSlotsParams("551070e6-1","default","item"):null;$mp.data=Object.assign({},{$root:{m0:m0,m1:m1}})}',
{
scopedSlotsCompiler: 'augmented'
}
)
assertCodegen(
'<my-component><template v-slot="item">{{getValue(item.text)}}<template></my-component>',
'<my-component vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[\'default\']}}"><block><block wx:if="{{$root.m0}}">{{$root.m1}}</block></block></my-component>',
......
......@@ -64,7 +64,7 @@ module.exports = function getResolveScopedSlots (parent, state) {
updateIds(vueId, slot, params.node.name)
}
const fnBody = fn.get('value.body')
if (needSlotMode(fnBody, ids)) {
if (state.options.scopedSlotsCompiler === 'augmented' || needSlotMode(fnBody, ids)) {
if (replaceId(fnBody, ids)) {
const orgin = fnBody.get('body.0.argument')
const elements = orgin.get('elements')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册