2016-10-27 4 views
0

은 내가 v-for 루프에서 몇 <div> 요소를 만들려면 다음 코드를 사용 : 그것은 완벽하게 작동요소의 매개 변수에서 변수를 사용하는 방법은 무엇입니까?

<div class="row" v-for="sentinel in sentinels"> 
    <div class="cell date">{{ sentinel.when }}</div> 
    <div class="cell city">{{ sentinel.city }}</div> 
</div> 

.

나는 지금 <img> 요소와이를 확장하고 싶었 :

<div class="row" v-for="sentinel in sentinels"> 
    <div class="cell date">{{ sentinel.when }}</div> 
    <div class="cell city">{{ sentinel.city }}</div> 
    <div class="cell country"><img src={{ sentinel.flagURL }} title={{ sentinel.country }}></div> 
</div> 

이 콘솔에서 Uncaught Error: Error parsing template:(…) 오류와 함께 실패합니다.

sentinel.flagURLsentinel.country은 디버거로 확인할 때 올바른 (예상되는) 값을 갖습니다.

태그를 여는 것과 닫는 것 사이의 변수뿐만 아니라 태그의 매개 변수에도 변수 ({{ sentinel.whatever }})를 사용할 수 있습니까? HTML에

<div class="cell country"><img :src="sentinel.flagURL" :title="sentinel.country"></div> 

이미지 태그 :

+0

https://vuejs.org/guide/syntax.html#Attributes – epascarello

+0

@epascarello : 감사합니다 . 내가받은 대답에 대한 귀하의 링크를 편집했습니다. – WoJ

답변

관련 문제