diff --git a/packages/uni-template-compiler/lib/app/util.js b/packages/uni-template-compiler/lib/app/util.js index 9e2f4f1c3cd104af25376793bf9df2c18c727983..429286756f372f618f0341e6e805015fc8381508 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