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