Skip to content

Commit ebedccc

Browse files
authored
fix(compiler-core): allow unicode to appear in identifiers (#3443)
fix #3440
1 parent 7715c49 commit ebedccc

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

packages/compiler-core/__tests__/transforms/vModel.spec.ts

+7
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,13 @@ describe('compiler: transform v-model', () => {
507507
)
508508
})
509509

510+
test('allow unicode', () => {
511+
const onError = jest.fn()
512+
parseWithVModel('<span v-model="变.量" />', { onError })
513+
514+
expect(onError).toHaveBeenCalledTimes(0)
515+
})
516+
510517
test('used on scope variable', () => {
511518
const onError = jest.fn()
512519
parseWithVModel('<span v-for="i in list" v-model="i" />', {

packages/compiler-core/src/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const nonIdentifierRE = /^\d|[^\$\w]/
5656
export const isSimpleIdentifier = (name: string): boolean =>
5757
!nonIdentifierRE.test(name)
5858

59-
const memberExpRE = /^[A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$][\w$]*|\[[^\]]+\])*$/
59+
const memberExpRE = /^[A-Za-z_$\xA0-\uFFFF][\w$\xA0-\uFFFF]*(?:\s*\.\s*[A-Za-z_$\xA0-\uFFFF][\w$\xA0-\uFFFF]*|\[[^\]]+\])*$/
6060
export const isMemberExpression = (path: string): boolean => {
6161
if (!path) return false
6262
return memberExpRE.test(path.trim())

0 commit comments

Comments
 (0)