[IMP] component: support dynamic t-component

This commit is contained in:
Géry Debongnie
2019-09-21 09:28:56 +02:00
parent bbbaf95c8e
commit cc82b3ffcd
10 changed files with 133 additions and 101 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
import { compileExpr, QWebVar } from "./expression_parser";
export const INTERP_REGEXP = /\{\{.*?\}\}/g;
//------------------------------------------------------------------------------
// Compilation Context
//------------------------------------------------------------------------------
@@ -163,7 +164,7 @@ export class Context {
* '{{x ? 'a': 'b'}}' -> (x ? 'a' : 'b')
*/
interpolate(s: string): string {
let matches = s.match(/\{\{.*?\}\}/g);
let matches = s.match(INTERP_REGEXP);
if (matches && matches[0].length === s.length) {
return `(${this.formatExpression(s.slice(2, -2))})`;
}