mirror of
https://github.com/anatolykopyl/vue-todo-list.git
synced 2026-03-26 21:05:19 +00:00
Added drag and drop
This commit is contained in:
64
src/App.vue
Normal file
64
src/App.vue
Normal file
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<Header />
|
||||
<AddTodo v-on:add-todo="addTodo"/>
|
||||
<Todos v-bind:todos="todos" v-on:del-todo="deleteTodo" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uuid from 'uuid'
|
||||
|
||||
import Header from "./components/layout/Header";
|
||||
import Todos from "./components/Todos";
|
||||
import AddTodo from "./components/AddTodo";
|
||||
|
||||
export default {
|
||||
name: 'app',
|
||||
components: {
|
||||
Header,
|
||||
Todos,
|
||||
AddTodo
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
todos: [
|
||||
{
|
||||
id: uuid.v4(),
|
||||
name: "Что-то, что я собираюсь сделать",
|
||||
completed: false
|
||||
},
|
||||
{
|
||||
id: uuid.v4(),
|
||||
name: "Что-то, что я уже сделал",
|
||||
completed: true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
deleteTodo(id) {
|
||||
this.todos = this.todos.filter(todo => todo.id !== id);
|
||||
},
|
||||
addTodo(n) {
|
||||
(n !== '' & n !== ' ') && this.todos.push({
|
||||
id: uuid.v4(),
|
||||
name: n,
|
||||
completed: false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@import url('https://fonts.googleapis.com/css?family=Oswald&display=swap');
|
||||
#app {
|
||||
font-family: 'Oswald', sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-align: center;
|
||||
color: ;
|
||||
margin-top: 50px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user