Vue

by rokerok_22

HTML

<div id="app">
  <button @click='project_1_on'>Проект-1</button>
  <button @click='project_2_on'>Проект-2</button>  
  <ul class="row" 
  v-for="(task, i) in group[index].tasks" 
  :key="task.name">
    <li>
      <input id="i" class="col-2" type="checkbox"   v-model="task.done" :key='i'>
      <label for="i" class="col-8" 
      :class="{ done: task.done }" :key='i'>
        {{ task.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;  
}

Vue

new Vue({
  el: "#app",
  data: {
  	index: 0,
    group: [
    	{
      name: 'Проект-1',
      tasks: [
        {name: 'задача_1', done: false}, 
        {name: 'задача_2', done: false}
        ]
      },
      {
      name: 'Проект-2',
      tasks: [
        {name: 'задача_11', done: false}, 
        {name: 'задача_22', done: false}
        ]
      },
    ]
  },
  methods: {
  
  	getDone(task) {
			task.done = !task.done;
		},
    project_1_on() {
    	this.index = 0;
    },
     project_2_on() {
    	this.index = 1;
    }
    
  }
})