Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. <template>
  2. <div id="app">
  3. <header class="page-header"></header>
  4. <section class="wrapper">
  5. <form class="new-todo-form">
  6. <label class="new-todo-label">
  7. New Todo:
  8. <input v-model="newTodo" type="text" class="new-todo-input"/>
  9. </label>
  10. <button type="submit" @click.prevent="addTodo()" class="new-todo-button">Add</button>
  11. </form>
  12. <ul class="todo-list">
  13. <li v-for="todo in todos" :key="todo.id" class="todo-item">
  14. <label v-if="currentlyEditing !== todo.id" class="todo-item-label">
  15. <input
  16. type="checkbox"
  17. v-model="todo.completed"
  18. @change="updateTodo(todo)"
  19. class="todo-item__checkbox">
  20. {{todo.text}}
  21. </label>
  22. <div v-if="currentlyEditing !== todo.id">
  23. <button
  24. @click="editTodo(todo)"
  25. class="todo-button">
  26. <img src="./assets/pencil.svg" alt="Edit todo">
  27. </button>
  28. <button
  29. @click="deleteTodo(todo)"
  30. class="todo-button">
  31. <img src="./assets/trash.svg" alt="Delete todo">
  32. </button>
  33. </div>
  34. <form v-else class="edit-todo-form">
  35. <label class="edit-todo-label">
  36. Edit:
  37. <input type="text" v-model="todoEditText" class="edit-todo-input">
  38. </label>
  39. <button
  40. type="submit"
  41. class="edit-todo-button"
  42. @click.prevent="updateTodoText()">
  43. Save
  44. </button>
  45. </form>
  46. </li>
  47. </ul>
  48. </section>
  49. </div>
  50. </template>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement