Vue
by Daedalus
HTML
<div id="app">
<color-table></color-table>
</div>
CSS
body {
background: #20262E;
padding: 20px;
font-family: Helvetica;
}
#app {
background: #fff;
border-radius: 4px;
padding: 20px;
transition: all 0.2s;
}
li {
margin: 8px 0;
}
h2 {
font-weight: bold;
margin-bottom: 15px;
}
del {
color: rgba(0, 0, 0, 0.3);
}
Vue
Vue.component('color-table', {
template: `<table cellspacing="3" style="border: 2px outset lightgrey; background: lightgrey;">
<tr>
<td style="text-align: center; border: 1px inset grey; width: 15px;" v-for="num in top">{{num}}</td>
</tr>
<tr>
<td style="text-align: center; border: 1px inset grey; width: 15px;" v-for="num in bottom">{{num}}</td>
</tr>
</table>`,
data() {
retur
top: [0, 1, 2, 3, 4, 5, 6, 7],
bottom: [8, 9, 10, 11, 12, 13, 14, 15]
}
});
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: {
toggle: function(todo){
todo.done = !todo.done
}
}
})