Skip to content

Instantly share code, notes, and snippets.

@devjin0617
Created January 19, 2017 12:25
Show Gist options
  • Save devjin0617/ecdd16fca5abc373996321247680e8c0 to your computer and use it in GitHub Desktop.
Save devjin0617/ecdd16fca5abc373996321247680e8c0 to your computer and use it in GitHub Desktop.
<!-- 오류 예제 -->
<div id="app">
<div v-for="item in list">
<div v-bind:id="bindId(item)">{{item}}</div> <!-- 2 -->
</div>
</div>
<script>
new Vue({
el: '#app',
data: function() {
return {
list: []
};
},
created: function() {
var self = this;
for(var i=0; i<100; i++) {
this._data.list.push(i); // 1
}
var dom = document.getElementById('item-0'); // 4
dom.style.backgroundColor = 'red'; // 5
},
methods: {
bindId: function(item) {
return 'item-' + item; // 3
}
}
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment