fix(reactivity-transform): fix props access codegen for non-identifier prop names (#5436)
fix #5425
This commit is contained in:
@@ -171,3 +171,11 @@ export const getGlobalThis = (): any => {
|
||||
: {})
|
||||
)
|
||||
}
|
||||
|
||||
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/
|
||||
|
||||
export function genPropsAccessExp(name: string) {
|
||||
return identRE.test(name)
|
||||
? `__props.${name}`
|
||||
: `__props[${JSON.stringify(name)}]`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user