diff --git a/packages/uni-template-compiler/__tests__/compiler-extra.spec.js b/packages/uni-template-compiler/__tests__/compiler-extra.spec.js
index 5872a6aac3c4a1d9428e69b5590f20a2b9fcbedf..058238a33fe39d419cccbc7c62ea92739b92e1a7 100644
--- a/packages/uni-template-compiler/__tests__/compiler-extra.spec.js
+++ b/packages/uni-template-compiler/__tests__/compiler-extra.spec.js
@@ -865,6 +865,11 @@ describe('mp:compiler-extra', () => {
'',
'with(this){if(!_isMounted){e0=()=>test(encodeURIComponent(JSON.stringify(arr)))}}'
)
+ assertCodegen(
+ '',
+ '',
+ 'with(this){if(!_isMounted){e0=function($event){test(a().b)}}}'
+ )
})
it('generate bool attr', () => {
assertCodegen(
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 c13e2f5b018ddf6de611f86e6aed6905970ebd86..b917f1e8a8256d46d32a7665993804a2ace808ed 100644
--- a/packages/uni-template-compiler/lib/script/traverse/data/event.js
+++ b/packages/uni-template-compiler/lib/script/traverse/data/event.js
@@ -322,7 +322,16 @@ function parseEvent (keyPath, valuePath, state, isComponent, isNativeOn = false,
const funcParams = funcPath.node.params
if (body && body.length && funcParams && funcParams.length === 1 && !hasMemberExpression(funcPath)) {
const exprStatements = body.filter(node => {
- return t.isExpressionStatement(node) && t.isCallExpression(node.expression)
+ return t.isExpressionStatement(node) && t.isCallExpression(node.expression) && !node.expression.arguments.find(element => {
+ // click1(item().a)
+ if (t.isMemberExpression(element)) {
+ try {
+ getIdentifierName(element)
+ } catch {
+ return true
+ }
+ }
+ })
})
if (exprStatements.length === body.length) {
const paramPath = funcPath.get('params')[0]