mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[REF] qweb: improve t-on generated code
and deduplicate logic between directive t-on applied on a node and on a component
This commit is contained in:
@@ -46,12 +46,12 @@ export class CompilationContext {
|
||||
* Such a key is necessary when we need to associate an id to some element
|
||||
* generated by a template (for example, a component)
|
||||
*/
|
||||
generateTemplateKey(): string {
|
||||
generateTemplateKey(prefix: string = ""): string {
|
||||
const id = this.generateID();
|
||||
if (this.loopNumber === 0 && !this.currentKey) {
|
||||
return `'__${id}__'`;
|
||||
return `'${prefix}__${id}__'`;
|
||||
}
|
||||
let locationExpr = `\`__${id}__`;
|
||||
let locationExpr = `\`${prefix}__${id}__`;
|
||||
for (let i = 0; i < this.loopNumber - 1; i++) {
|
||||
locationExpr += `\${i${i + 1}}__`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user