From cc9bfaeb7af269cec54bafa9b8f3c957e715a10e Mon Sep 17 00:00:00 2001 From: qiang Date: Wed, 19 Aug 2020 11:42:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=83=85=E5=86=B5=E5=A4=9A=E5=B1=82=20v-for=20=E5=B5=8C?= =?UTF-8?q?=E5=A5=97=E7=BC=96=E8=AF=91=E5=88=B0=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E4=BD=9C=E7=94=A8=E5=9F=9F=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20fixed=20#2034?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../uni-template-compiler/lib/script/traverse/member-expr.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni-template-compiler/lib/script/traverse/member-expr.js b/packages/uni-template-compiler/lib/script/traverse/member-expr.js index 70aba6c23..f5d32f1a1 100644 --- a/packages/uni-template-compiler/lib/script/traverse/member-expr.js +++ b/packages/uni-template-compiler/lib/script/traverse/member-expr.js @@ -25,7 +25,7 @@ function findScoped (path, test, state) { path.traverse({ noScope: true, Identifier (path) { - if (path.key !== 'key' && (path.key !== 'property' || path.parent.computed)) { + if (!match && path.key !== 'key' && (path.key !== 'property' || path.parent.computed)) { match = isMatch(path.node.name, forItem, forIndex) if (match) { path.stop() @@ -37,7 +37,7 @@ function findScoped (path, test, state) { traverse(t.arrayExpression([test]), { noScope: true, Identifier (path) { - if (path.key !== 'key' && (path.key !== 'property' || path.parent.computed)) { + if (!match && path.key !== 'key' && (path.key !== 'property' || path.parent.computed)) { const node = path.node match = isMatch(node.name, forItem, forIndex) || scoped.declarationArray.find(({ declarations }) => declarations.find(({ id }) => id === node)) if (match) { -- GitLab