From 1253609317667de45d90367753606d4488721a5a Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Mon, 11 May 2020 17:21:51 +0800 Subject: [PATCH] fix(mp-weixin): Scoped Slots #1662 --- packages/uni-mp-weixin/lib/uni.compiler.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/uni-mp-weixin/lib/uni.compiler.js b/packages/uni-mp-weixin/lib/uni.compiler.js index d70bf8b4..f6d43229 100644 --- a/packages/uni-mp-weixin/lib/uni.compiler.js +++ b/packages/uni-mp-weixin/lib/uni.compiler.js @@ -46,14 +46,15 @@ module.exports = { if (!state.scopedSlots) { state.scopedSlots = {} } - let componentName = `${ownerName}-${parentName}-${slotName}` - if (!hasOwn(state.scopedSlots, componentName)) { - state.scopedSlots[componentName] = 0 + const baseName = `${ownerName}-${parentName}-${slotName}` + let componentName = baseName + if (!hasOwn(state.scopedSlots, baseName)) { + state.scopedSlots[baseName] = 0 } - if (state.scopedSlots[componentName]) { - componentName = componentName + state.scopedSlots[componentName] + if (state.scopedSlots[baseName]) { + componentName = baseName + state.scopedSlots[baseName] } - state.scopedSlots[componentName]++ + state.scopedSlots[baseName]++ parentNode.attr['generic:scoped-slots-' + slotName] = componentName if (!parentNode.attr.generic) { parentNode.attr.generic = {} -- GitLab