Fixed bug was only replacing first match
This commit is contained in:
parent
1c646d0528
commit
e455b88de9
|
@ -31,10 +31,12 @@ app.template = {
|
||||||
.replace(/\}$/, ''));
|
.replace(/\}$/, ''));
|
||||||
}
|
}
|
||||||
for (var i = 0; i < matches.length; i++) {
|
for (var i = 0; i < matches.length; i++) {
|
||||||
const k = matches[0];
|
const k = matches[i];
|
||||||
if (k.match(/^[a-zA-Z0-9_\.]+$/))
|
if (k.match(/^[a-zA-Z0-9_\.]+$/)) {
|
||||||
tpl = tpl.replaceAll('{.'+k+'}',
|
const v = eval(`data.${k}`);
|
||||||
eval(`data.${k}`));
|
if (v !== undefined)
|
||||||
|
tpl = tpl.replaceAll('{.'+k+'}',v);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return tpl;
|
return tpl;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue