JSFiddle - React, Tailwind, and code Playground
HTML
<script src="//cdnjs.cloudflare.com/ajax/libs/vue/2.5.3/vue.min.js"></script>
<div id="app">
<button v-for="(n, i) in group" @click="activeProject = i">{{ n.name }}</button>
<ul>
<li v-for="(n, i) in group[activeProject].tasks" :key="n.name">
<input type="checkbox" :id="i" v-model="n.done">
<label :for="i" :class="{ done: n.done }">
{{ n.name }}
</label>
</li>
</ul>
</div>
CSS
body {
background: #20262E;
padding: 20px;
font-family: Helvetica;
}
#app {
background: #fff;
border-radius: 4px;
padding: 20px;
transition: all 0.2s;
}
.done {
text-decoration: line-through;
color: rgba(1, 0, 0, 0.4);
}
input[type="checkbox"] { display: none; }
input[type="checkbox"] + label {
display: block;
position: relative;
padding-left: 35px;
margin-bottom: 20px;
font: 14px/20px 'Open Sans', Arial, sans-serif;
color: black;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
input[type="checkbox"] + label:before {
content: '';
display: block;
width: 20px;
height: 20px;
border: 2px solid black;
border-radius: 3px;
position: absolute;
left: 0;
top: 0;
opacity: .8;
-webkit-transition: all .12s, border-color .08s;
transition: all .12s, border-color .08s;
}
input[type="checkbox"]:checked + label:before {
width: 10px;
top: -5px;
left: 5px;
border-radius: 0;
opacity: 1;
border-top-color: transparent;
border-left-color: transparent;
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
li {
margin: 5px 0;
list-style-type: none;
}
JavaScript
new Vue({
el: "#app",
data: {
activeProject: 0,
group: [
{
name: 'Проект-1',
tasks: [
{ name: 'задача_1', done: false },
{ name: 'задача_2', done: false },
],
},
{
name: 'Проект-2',
tasks: [
{ name: 'задача_11', done: false },
{ name: 'задача_22', done: false },
],
},
],
},
});