Vue
by mizobata
HTML
<div id="app">
<div class="todo-list">
<div
v-for="todo in todos"
class="todo-text"
>
{{ todo.text }}
</div>
</div>
</div>
<script type="template/x-template" id="description">
</script>
CSS
body {
background: #20262E;
padding: 20px;
font-family: Helvetica;
}
#app {
background: #fff;
border-radius: 4px;
padding: 20px;
transition: all 0.2s;
}
.todo-text {
height: 25px;
line-height: 25px;
cursor: pointer;
}
.todo-text:hover {
background: #eee;
}
Vue
const descriptionComponent = new Vue({
el: '#description',
data() {
return {
description: 'tettetetettetetete'
}
}
})
new Vue({
el: "#app",
data: {
todos: [
{ text: "Learn JavaScript", done: false },
{ text: "Learn Vue", done: false },
{ text: "Play around in JSFiddle", done: true },
{ text: "Build something awesome", done: true }
]
},
methods: {
handleClickTodo() {
const description = Vue.component('description')
},
toggle: function(todo){
todo.done = !todo.done
}
}
})