trying to make progress whilst still messing with the vuex store is not going well
| | |
| | | :todoItem=item |
| | | ></TodoItem> |
| | | </div> |
| | | Should be here <XofYitems/>Should be here |
| | | <!-- <span>x out of {{todos.length}} done</span> --> |
| | | <XofYitems /> |
| | | <span> {{sumDoneTodoItems(todos)}}out of {{this.todos.length}} done</span> |
| | | </md-list> |
| | | </template> |
| | | |
| | |
| | | name: "ListOfTodos", |
| | | props: {}, |
| | | components: { |
| | | TodoItem |
| | | TodoItem, |
| | | XofYitems |
| | | }, |
| | | computed: { |
| | | ...mapGetters( |
| | |
| | | // }); |
| | | }, |
| | | methods: { |
| | | updateTodoList(todo) { |
| | | this.todos.push(todo); |
| | | // updateTodoList(todo) { |
| | | // this.todos.push(todo); |
| | | // }, |
| | | sumDoneTodoItems(todos) { |
| | | return todos.reduce((result, tdItem) => tdItem.complete ? result + 1 : result, 0); |
| | | } |
| | | } |
| | | }; |
| | |
| | | <md-button |
| | | @click="markImportant" |
| | | > |
| | | <svg :class="{'red-flag': isImportant}" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" @click="markDone"> |
| | | <svg :class="{'red-flag': todoItem.important}" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" @click="markDone"> |
| | | <path d="M0 0h24v24H0z" fill="none"/> |
| | | <path d="M14.4 6L14 4H5v17h2v-7h5.6l.4 2h7V6z"/> |
| | | </svg> |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | isActive: false, |
| | | isImportant: false |
| | | // isActive: false, |
| | | // isImportant: false |
| | | }; |
| | | }, |
| | | methods: { |
| | | markDone() { |
| | | // set to greyed out / true false |
| | | this.isActive = !this.isActive; |
| | | console.info("INFO - ", this.todoItem, this.isActive); |
| | | // Delete me below even if it works |
| | | this.todoItem.complete = !this.todoItem.complete; |
| | | console.info("INFO - ", this.todoItem, this.todoItem.complete); |
| | | }, |
| | | markImportant() { |
| | | // set to greyed out / true false |
| | | this.isImportant = !this.isImportant; |
| | | console.info("INFO - ", this.todoItem, this.isImportant); |
| | | this.todoItem.important = !this.todoItem.important; |
| | | console.info("INFO - ", this.todoItem, this.todoItem.important); |
| | | } |
| | | } |
| | | }; |
| | |
| | | <template> |
| | | <div> |
| | | <label>TestXofY</label> |
| | | <span>x out of {{todos.length}} done</span> |
| | | </div> |
| | | </template> |
| | |
| | | } |
| | | const todo = { |
| | | title: state.newTodo, |
| | | completed: false |
| | | completed: false, |
| | | important: false |
| | | }; |
| | | axios.post(config.todoEndpoint, todo).then(mongoTodo => { |
| | | // debugger |
| | |
| | | { |
| | | title: "Have a poop", |
| | | id: "123", |
| | | complete: true |
| | | complete: true, |
| | | important: false |
| | | } |
| | | ], |
| | | newTodo: "" |