카테고리 없음

[자바 스크립트] 일련의 명명 된 개체가있는 개체에 대해 작업 할 콧수염 템플릿

행복을전해요 2021. 2. 23. 03:18

값을 Mustache에 전달하기 전에 준비해야합니다.

var values = [];
for (var key in folios) {
  if (Object.prototype.hasOwnProperty.call(folios, key)) {
      values.push(folios[key]);
        }
        }
        
        var tpl = document.getElementById('folioTemplate').innerHTML;
        document.getElementById("folios").innerHTML = Mustache.render(tpl, {'folios': values});
        


출처
https://stackoverflow.com/questions/22080029