diff --git a/packages/uni-mp-alipay/lib/uni.compiler.js b/packages/uni-mp-alipay/lib/uni.compiler.js index ba74a36a8186caeffabb7384bfca0967deb699b9..69ebd4255ba2e973bf9f20b82b473f06a9f89d8a 100644 --- a/packages/uni-mp-alipay/lib/uni.compiler.js +++ b/packages/uni-mp-alipay/lib/uni.compiler.js @@ -126,7 +126,7 @@ module.exports = { Identifier (path) { const node = path.node const name = node.name - if (names.includes(name) && path.key !== 'key' && path.key !== 'property' && !(path.scope && path.scope.hasBinding(name))) { + if (names.includes(name) && path.key !== 'key' && (path.key !== 'property' || path.parent.computed) && !(path.scope && path.scope.hasBinding(name))) { path.replaceWithSourceString(`${paramName}.${name}`) } } diff --git a/packages/uni-template-compiler/lib/script/traverse/data/event.js b/packages/uni-template-compiler/lib/script/traverse/data/event.js index bbb42c8b2674a9c08954f1eff12e4dbe9888b4e3..12760adf673f8d0e450937efcd4f651b5b7c06b6 100644 --- a/packages/uni-template-compiler/lib/script/traverse/data/event.js +++ b/packages/uni-template-compiler/lib/script/traverse/data/event.js @@ -335,7 +335,7 @@ function parseEvent (keyPath, valuePath, state, isComponent, isNativeOn = false, const scope = path.scope const node = path.node const name = node.name - if (path.key !== 'key' && path.key !== 'property' && scope && !scope.hasOwnBinding(name) && scope.hasBinding(name)) { + if (path.key !== 'key' && (path.key !== 'property' || path.parent.computed) && scope && !scope.hasOwnBinding(name) && scope.hasBinding(name)) { params.push(name) } }