diff --git a/packages/uni-mp-compiler/__tests__/scopedSlot.spec.ts b/packages/uni-mp-compiler/__tests__/scopedSlot.spec.ts
index 09d536e9bb5c74780f99ca619b82b1640a9dc2fe..274def241d4f70e10d913c57b83d98eede4b3a57 100644
--- a/packages/uni-mp-compiler/__tests__/scopedSlot.spec.ts
+++ b/packages/uni-mp-compiler/__tests__/scopedSlot.spec.ts
@@ -25,6 +25,24 @@ describe('compiler: transform scoped slots', () => {
``,
`(_ctx, _cache) => {
return _e({ a: _ctx.ok }, _ctx.ok ? { b: _r("header", { item: _ctx.item, index: _ctx.index }) } : {})
+}`
+ )
+ })
+ test('v-for + v-for + scoped slots', () => {
+ assert(
+ ``,
+ ``,
+ `(_ctx, _cache) => {
+ return { a: _f(4, (item, index, i0) => { return { a: _f(4, (item, index, i1) => { return { a: "d-" + i0 + '-' + i1, b: _r("d", { text: 1 }, i0 + '-' + i1) }; }), b: index }; }) }
+}`
+ )
+ })
+ test('v-for + v-for + v-for + scoped slots', () => {
+ assert(
+ ``,
+ ``,
+ `(_ctx, _cache) => {
+ return { a: _f(4, (item, index, i0) => { return { a: _f(4, (item, index, i1) => { return { a: _f(4, (item, index, i2) => { return { a: "d-" + i0 + '-' + i1 + '-' + i2, b: _r("d", { text: 1 }, i0 + '-' + i1 + '-' + i2) }; }) }; }), b: index }; }) }
}`
)
})
diff --git a/packages/uni-mp-compiler/__tests__/slot.spec.ts b/packages/uni-mp-compiler/__tests__/slot.spec.ts
index 76147a7be7571ec57f1c42de82a942153a76b63e..98931b21283f43b2e44575fcd0e622563ac086ce 100644
--- a/packages/uni-mp-compiler/__tests__/slot.spec.ts
+++ b/packages/uni-mp-compiler/__tests__/slot.spec.ts
@@ -99,7 +99,7 @@ describe('compiler: transform slot', () => {
``,
``,
`(_ctx, _cache) => {
- return { a: _f(_ctx.items, (item, index, i0) => { return { a: _f(item.list, (item1, index1, i1) => { return { a: "d-" + i0 + '-' + i1, b: _r("d", { key: index1 }, i1) }; }), b: index }; }) }
+ return { a: _f(_ctx.items, (item, index, i0) => { return { a: _f(item.list, (item1, index1, i1) => { return { a: "d-" + i0 + '-' + i1, b: _r("d", { key: index1 }, i0 + '-' + i1) }; }), b: index }; }) }
}`
)
})
diff --git a/packages/uni-mp-compiler/src/transforms/transformSlot.ts b/packages/uni-mp-compiler/src/transforms/transformSlot.ts
index 8155aaaaf8bd8ffb42b6e479805d2c305a627596..90b8dd8454a4e6805c14ea5c15fb18ab217b87d1 100644
--- a/packages/uni-mp-compiler/src/transforms/transformSlot.ts
+++ b/packages/uni-mp-compiler/src/transforms/transformSlot.ts
@@ -97,7 +97,7 @@ export function rewriteSlot(node: SlotOutletNode, context: TransformContext) {
slotName,
',',
`{${properties.join(',')}}`,
- `${vForIndexAlias ? ',' + vForIndexAlias : ''}`,
+ `${vForIndexAlias ? ',' + parseScopedSlotKey(context) : ''}`,
')',
]),
context
diff --git a/packages/uni-mp-vue/lib/vue.runtime.esm.js b/packages/uni-mp-vue/lib/vue.runtime.esm.js
index d2747291db1c1ddfd3cbd2f95729c7e93c11c748..6113ef91c387bbf3db15d98aa38176ad8e3a005c 100644
--- a/packages/uni-mp-vue/lib/vue.runtime.esm.js
+++ b/packages/uni-mp-vue/lib/vue.runtime.esm.js
@@ -4989,7 +4989,7 @@ function componentUpdateScopedSlotsFn() {
const diffData = Object.create(null);
scopedSlotsData.forEach(({ path, index, data }) => {
const oldScopedSlotData = getValueByDataPath(oldData, path);
- const diffPath = `${path}[${index}]`;
+ const diffPath = isString(index) ? `${path}.${index}` : `${path}[${index}]`;
if (typeof oldScopedSlotData === 'undefined' ||
typeof oldScopedSlotData[index] === 'undefined') {
diffData[diffPath] = data;