##前提
Vue.js 2.0を使っています。
##やりたいこと
v-forの中でv-bindを使いたいです。
ネット上の記事を探してみたのですが、v-forの中で使っている例は見つからず困っています。
皆さまはforの中でv-bindをどのように使われているのでしょうか?
##コード
html
1<div id="message_board"> 2 <div v-for="item in items"> 3 <div> 4 <img v-bind:src={{item.icon}}> 5 </div> 6 </div> 7</div>
javascript
1var message_board = new Vue({ 2 el: '#message_board', 3 data: { 4 items: [ 5 { icon: 'https://pbs.twimg.com...'}, 6 { icon: 'https://pbs.twimg.com...'}, 7 { icon: 'https://pbs.twimg.com...'}, 8 ] 9 } 10 })
##エラー
[Vue warn]: failed to compile template
invalid expression: v-bind:src="{{item.icon}}"
##試したこと
<img v-bind:src="{{item.icon}}">
<img v-bind:src={{item.icon}}>
上記2点ともうまくいきませんでした。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/02/13 16:23
2017/02/13 16:24
2017/02/13 17:08