2017-09-11 2 views
0

옥 (pug)을 사용하여 필요한 HTML 페이지를 동적으로 만듭니다. 여기에는 aframe 태그 생성이 포함됩니다. kframe 템플릿 구성 요소를 사용할 때 오류가 발생합니다.aframe : 옥 아래 서식 파일로 데이터를 전달하는 중 오류가 발생했습니다.

a-scene(embedded) 
    a-assets 
    script#boxesTemplate(type='text/x-jade-template') 
     a-box(color="${color1}") 
    a-entity(template='src: #boxesTemplate;', data-color1="blue", position="1 0 1") 
    a-entity(template='src: #boxesTemplate;', data-color1="red", position="3 0 2") 

생성 된 HTML 태그는 정상적으로 보입니다. 그러나 자바 스크립트 콘솔에 표시됩니다 :

THREE.Color: Unknown color ${color1} 

왜 이런 현상이 발생합니까? 감사.

라지

답변

0

그것은 당신이 마음에 들지 정확히 무엇을하지만,이 두 예는 나를 위해 작동 :

a-assets 
    script#boxesTemplate1(type="text/x-html-template"). 
    <a-box color="${box}" position="-1 0 -5"></a-box> 
    script#boxesTemplate2(type="text/x-nunjucks-template"). 
    <a-box color="{{box}}" position="1 0 -5"></a-box> 

a-entity(template="src: #boxesTemplate1" data-box="red") 
a-entity(template="src: #boxesTemplate2" data-box="blue") 

은 어쩌면 템플릿의 type 속성은 '바르'의 구문을 정의합니다. 텍스트/x-jade-template이 전체 파일과 충돌 할 수 있습니다.

또한, HTML 파일 (옥없는 파일)이 작동 :

<a-scene> 
    <script id="boxesTemplate3" type="text/x-jade-template"> 
    a-box(color="#{box}" position="0 1 -5") 
    </script> 
</a-assets> 
<a-entity template="src: #boxesTemplate3" data-box="green"></a-entity> 

¡ saludos을!

+0

감사합니다. 예, 문제가 유형에있었습니다. – Raj

관련 문제