Browse Source
fix(compiler-core): fix v-on with modifiers on inline expression of undefined (#9866)
close #9865
improve isMemberExpression check for undefined
pull/9857/head
白雾三语
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
5 additions and
1 deletions
-
packages/compiler-core/__tests__/utils.spec.ts
-
packages/compiler-core/src/utils.ts
|
|
@ -122,6 +122,10 @@ describe('isMemberExpression', () => { |
|
|
|
expect(fn(`123[a]`)).toBe(true) |
|
|
|
expect(fn(`foo() as string`)).toBe(false) |
|
|
|
expect(fn(`a + b as string`)).toBe(false) |
|
|
|
// #9865
|
|
|
|
expect(fn('""')).toBe(false) |
|
|
|
expect(fn('undefined')).toBe(false) |
|
|
|
expect(fn('null')).toBe(false) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
@ -163,7 +163,7 @@ export const isMemberExpressionNode = __BROWSER__ |
|
|
|
return ( |
|
|
|
ret.type === 'MemberExpression' || |
|
|
|
ret.type === 'OptionalMemberExpression' || |
|
|
|
ret.type === 'Identifier' |
|
|
|
(ret.type === 'Identifier' && ret.name !== 'undefined') |
|
|
|
) |
|
|
|
} catch (e) { |
|
|
|
return false |
|
|
|