[IMP] qweb: t-props directive

We reimplement the directive "t-props" and add some tests for it.
This commit is contained in:
Mathieu Duckerts-Antoine
2021-10-20 15:25:32 +02:00
committed by Aaron Bohy
parent 8c71d99e5f
commit b6eb4d009e
7 changed files with 181 additions and 5 deletions
+10 -1
View File
@@ -905,7 +905,16 @@ export class QWebCompiler {
for (let p in ast.props) {
props.push(`${p}: ${compileExpr(ast.props[p]) || undefined}`);
}
const propString = `{${props.join(",")}}`;
const propStr = `{${props.join(",")}}`;
let propString = propStr;
if (ast.dynamicProps) {
if (!props.length) {
propString = `${compileExpr(ast.dynamicProps)}`;
} else {
propString = `Object.assign({}, ${compileExpr(ast.dynamicProps)}, ${propStr})`;
}
}
// cmap key
const key = this.generateComponentKey();