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 70aba6c2346f0a479ece2f21105d2a44190c4e7d..f5d32f1a1bb350e8023e77e1cc973684b71fe825 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) {