|
@@ -80,6 +80,15 @@ function looper(scope) {
|
|
|
let html = [];
|
|
|
// If data is an array (if not do nothing)
|
|
|
if (data && Array.isArray(data)) {
|
|
|
+ // If data is already computed back to the initial value
|
|
|
+ const defaultValue = el.querySelector('[data-looped]')
|
|
|
+ if (defaultValue) {
|
|
|
+ el.innerHTML = defaultValue.innerHTML;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Add the not computed value
|
|
|
+ html.push(`<div data-looped="${propName}" style="display: none">${el.innerHTML}</div>`);
|
|
|
+
|
|
|
// Add info to replace value
|
|
|
for (let i = 0; i < data.length; i++) {
|
|
|
html.push(el.innerHTML.replace(/data-val="/g, 'data-index="' + i + '" data-val="'));
|