[FIX] components: allow prop names that are not valid bare property name

This commit is contained in:
Samuel Degueldre
2021-11-24 07:48:44 +01:00
committed by Aaron Bohy
parent b90180a9e0
commit 93b88cad8d
3 changed files with 45 additions and 1 deletions
+1 -1
View File
@@ -967,7 +967,7 @@ export class CodeGenerator {
const props: string[] = [];
let hasSlotsProp = false;
for (let p in ast.props) {
const propName = p.includes("-") ? `'${p}'` : p;
const propName = /^[a-z_]+$/i.test(p) ? p : `'${p}'`;
props.push(`${propName}: ${this.captureExpression(ast.props[p]) || undefined}`);
if (p === "slots") {
hasSlotsProp = true;