Guest User

Untitled

a guest
Jan 13th, 2021
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. <template>
  2. <div class="wrapper">
  3. <div class="todo-field">
  4. <input type="text">
  5. <button class="btn btn-add">
  6. Добавить
  7. </button>
  8. </div>
  9.  
  10. <div class="item-list">
  11. <div class="item-list__item"
  12. v-for="item in todos"
  13. >
  14. <div>
  15. {{item.goal}}
  16. </div>
  17. <div class="icon">
  18. <i class="gg-trash"></i>
  19. </div>
  20. </div>
  21. </div>
  22. </div>
  23. </template>
  24.  
  25. <script lang="ts">
  26. import { onMounted, ref} from 'vue';
  27. import { useStore } from "vuex";
  28. import { key } from "@/store/store";
  29. import { mapGetters } from "vuex";
  30. import {Todo} from '@/ts/types';
  31. export default {
  32. setup() {
  33. const store = useStore(key)
  34. const todos = ref(store.getters.getTodos).value.map((el: Todo) => {
  35. return Object.assign({}, el);
  36. });
  37. console.log(todos)
  38. return {
  39. todos
  40. }
  41. }
  42. }
  43. </script>
  44.  
  45. <style lang="scss">
  46. .wrapper {
  47. display: flex;
  48. flex-direction: column;
  49. align-items: center;
  50. }
  51.  
  52. .todo-field {
  53. display: flex;
  54. justify-content: center;
  55. width: 500px;
  56. margin-bottom: 16px;
  57. & input {
  58. width: 100%;
  59. margin-right: 8px;
  60. }
  61. & input, .btn-add{
  62. border: 1px solid #a4afba;
  63. background-color: transparent;
  64. box-shadow: none;
  65. color: #838a92;
  66. cursor: pointer;
  67. user-select: none;
  68. appearance: none;
  69. touch-action: manipulation;
  70. border-radius: 3px;
  71. padding: 4px 8px;
  72. outline: none;
  73. }
  74. }
  75.  
  76. .item-list {
  77. width: 500px;
  78. box-sizing: border-box;
  79. padding: 16px;
  80. background-color: #f7f7f7;
  81. border-radius: 8px;
  82. &__item {
  83. display: flex;
  84. justify-content: space-between;
  85. padding: 8px;
  86. border-bottom: 1px solid #d5dddf;
  87. }
  88. }
  89.  
  90. </style>
  91.  
Advertisement
Add Comment
Please, Sign In to add comment