Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <template>
- <div class="wrapper">
- <div class="todo-field">
- <input type="text">
- <button class="btn btn-add">
- Добавить
- </button>
- </div>
- <div class="item-list">
- <div class="item-list__item"
- v-for="item in todos"
- >
- <div>
- {{item.goal}}
- </div>
- <div class="icon">
- <i class="gg-trash"></i>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script lang="ts">
- import { onMounted, ref} from 'vue';
- import { useStore } from "vuex";
- import { key } from "@/store/store";
- import { mapGetters } from "vuex";
- import {Todo} from '@/ts/types';
- export default {
- setup() {
- const store = useStore(key)
- const todos = ref(store.getters.getTodos).value.map((el: Todo) => {
- return Object.assign({}, el);
- });
- console.log(todos)
- return {
- todos
- }
- }
- }
- </script>
- <style lang="scss">
- .wrapper {
- display: flex;
- flex-direction: column;
- align-items: center;
- }
- .todo-field {
- display: flex;
- justify-content: center;
- width: 500px;
- margin-bottom: 16px;
- & input {
- width: 100%;
- margin-right: 8px;
- }
- & input, .btn-add{
- border: 1px solid #a4afba;
- background-color: transparent;
- box-shadow: none;
- color: #838a92;
- cursor: pointer;
- user-select: none;
- appearance: none;
- touch-action: manipulation;
- border-radius: 3px;
- padding: 4px 8px;
- outline: none;
- }
- }
- .item-list {
- width: 500px;
- box-sizing: border-box;
- padding: 16px;
- background-color: #f7f7f7;
- border-radius: 8px;
- &__item {
- display: flex;
- justify-content: space-between;
- padding: 8px;
- border-bottom: 1px solid #d5dddf;
- }
- }
- </style>
Advertisement
Add Comment
Please, Sign In to add comment