From 04f0b3fd33718195c7451b5668862e4758b1cf2a Mon Sep 17 00:00:00 2001 From: qiang Date: Mon, 7 Jun 2021 21:12:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=90=AF=E7=94=A8=20b?= =?UTF-8?q?etterScopedSlots=20=E5=90=8E=20for=20=E5=BE=AA=E7=8E=AF?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98=20issues/495#issu?= =?UTF-8?q?ecomment-828486159?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/script/traverse/resolve-scoped-slots.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/uni-template-compiler/lib/script/traverse/resolve-scoped-slots.js b/packages/uni-template-compiler/lib/script/traverse/resolve-scoped-slots.js index 632e810a3..16ea38e0f 100644 --- a/packages/uni-template-compiler/lib/script/traverse/resolve-scoped-slots.js +++ b/packages/uni-template-compiler/lib/script/traverse/resolve-scoped-slots.js @@ -26,11 +26,11 @@ module.exports = function getResolveScopedSlots (parent, state) { if (!params) { return } - const vueId = parent.parentPath.parentPath.get('properties').find(path => path.get('key').isIdentifier({ name: 'attrs' })).get('value').get('properties').find(path => path.get('key').isStringLiteral({ value: 'vue-id' })).get('value').node.value + const vueId = parent.parentPath.parentPath.get('properties').find(path => path.get('key').isIdentifier({ name: 'attrs' })).get('value').get('properties').find(path => path.get('key').isStringLiteral({ value: 'vue-id' })).get('value').node const slot = properties.find(path => path.get('key').isIdentifier({ name: 'key' })).get('value').node.value const ids = {} function updateIds (vueId, slot, value, key) { - const array = [t.stringLiteral(vueId), t.stringLiteral(slot)] + const array = [vueId, t.stringLiteral(slot)] if (key) { array.push(t.stringLiteral(key)) } @@ -48,7 +48,7 @@ module.exports = function getResolveScopedSlots (parent, state) { const orgin = fnBody.get('body.0.argument') const elements = orgin.get('elements') const node = (elements.length === 1 ? elements[0] : orgin).node - const test = t.callExpression(t.identifier('$hasScopedSlotsParams'), [t.stringLiteral(vueId)]) + const test = t.callExpression(t.identifier('$hasScopedSlotsParams'), [vueId]) orgin.replaceWith(t.arrayExpression([t.conditionalExpression(test, node, t.callExpression(t.identifier(METHOD_CREATE_EMPTY_VNODE), []))])) } } -- GitLab