提交 cc9bfaeb 编写于 作者: Q qiang

fix: 修复部分情况多层 v-for 嵌套编译到小程序作用域错误的问题 fixed #2034

上级 6166e759
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册