浏览代码

Ajout verif val

Loquicom 5 年之前
父节点
当前提交
2dbbf5e860
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      src/js/binder.js

+ 4 - 1
src/js/binder.js

@@ -91,7 +91,10 @@ function looper(scope) {
       currentLoopElements = currentLoopElements[0].childNodes;
       for (const currentElement of currentLoopElements) {
         if (currentElement.nodeName !== "#text" && currentElement.getAttribute('data-index')) {
-          currentElement.innerHTML = scope[propName][currentElement.getAttribute('data-index')][currentElement.getAttribute('data-val')];
+          const val = scope[propName][currentElement.getAttribute('data-index')][currentElement.getAttribute('data-val')];
+          if (val) {
+            currentElement.innerHTML = scope[propName][currentElement.getAttribute('data-index')][currentElement.getAttribute('data-val')];
+          }
         }
       }
     }