提交 88a12a3a 编写于 作者: fxy060608's avatar fxy060608

fix(mp): nested scoped slots (#3886)

上级 c9d0e2f1
......@@ -69,6 +69,15 @@ describe('compiler: transform scoped slots', () => {
`<button wx:for="{{a}}" wx:for-item="item" wx:key="c"><block wx:if="{{$slots.text}}"><slot name="{{item.a}}"></slot></block><block wx:else>Submit</block></button>`,
`(_ctx, _cache) => {
return { a: _f(1, (item, k0, i0) => { return { a: "text-" + i0, b: _r("text", { item: item }, i0), c: item }; }) }
}`
)
})
test('scoped slots + slot', () => {
assert(
`<c><template #n="{ h }"><slot name="n" :h="h"></slot></template></c>`,
`<c u-s="{{['n']}}" u-i="2a9ec0b0-0"><view wx:for="{{a}}" wx:for-item="v0" wx:key="b" slot="{{v0.c}}"><slot name="n"></slot></view></c>`,
`(_ctx, _cache) => {
return { a: _w(({ h }, s0, i0) => { return { a: _r("n", { h: h }), b: i0, c: s0 }; }, { name: 'n', path: 'a', vueId: '2a9ec0b0-0' }) }
}`
)
})
......
......@@ -178,7 +178,7 @@ function parseScopedSlotKey(context: TransformContext) {
let { currentScope } = context
const indexes: string[] = []
while (currentScope) {
if (isVForScope(currentScope)) {
if (isVForScope(currentScope) && !isScopedSlotVFor(currentScope)) {
indexes.push(currentScope.indexAlias)
}
currentScope = currentScope.parent!
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册