diff --git a/packages/uni-mp-compiler/__tests__/scopedSlot.spec.ts b/packages/uni-mp-compiler/__tests__/scopedSlot.spec.ts
index b6365895352606f9db1bb2930569c03a8473ad61..5fd09578dcae1fe84921551283069eb42d02d643 100644
--- a/packages/uni-mp-compiler/__tests__/scopedSlot.spec.ts
+++ b/packages/uni-mp-compiler/__tests__/scopedSlot.spec.ts
@@ -69,6 +69,15 @@ describe('compiler: transform scoped slots', () => {
``,
`(_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(
+ ``,
+ ``,
+ `(_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' }) }
}`
)
})
diff --git a/packages/uni-mp-compiler/src/transforms/transformSlot.ts b/packages/uni-mp-compiler/src/transforms/transformSlot.ts
index 1fdeb2c86ce6d647798a6ce0c1a265e1a07a6721..b19400f4d9a307d62e90bc4d014a0b6aa716d015 100644
--- a/packages/uni-mp-compiler/src/transforms/transformSlot.ts
+++ b/packages/uni-mp-compiler/src/transforms/transformSlot.ts
@@ -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!