From d81a269aa70b2f8f3c1c20c3d0d055d65848cadc Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Fri, 12 Jun 2020 11:59:02 +0800 Subject: [PATCH] fix(v3): update scoped slot element id --- packages/uni-template-compiler/lib/app/util.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/uni-template-compiler/lib/app/util.js b/packages/uni-template-compiler/lib/app/util.js index 9e2f4f1c3..429286756 100644 --- a/packages/uni-template-compiler/lib/app/util.js +++ b/packages/uni-template-compiler/lib/app/util.js @@ -65,6 +65,9 @@ function updateEleId (el, it, state) { el.ifConditions && el.ifConditions.forEach((con, index) => { index !== 0 && updateEleId(con.block, it, state) }) + el.scopedSlots && Object.values(el.scopedSlots).forEach((slot, index) => { + updateEleId(slot, it, state) + }) } function getBindingAttr (el, name) { @@ -119,6 +122,9 @@ function getNewId (id, it) { function updateScopedSlotEleId (el, state) { // TODO 暂不考虑 scopedSlot 嵌套情况 if (el.slotScope) { + const getNewId = function (id, it) { + return Number.isInteger(id) ? `("${id}-"+${it})` : `(${id}+"-"+${it})` + } const updateEleId = function (el) { if (el.type !== 1) { return -- GitLab