commit | author | age
|
a34f1d
|
1 |
<template> |
D |
2 |
<div> |
fbee7b
|
3 |
<div class="itemCardAndFlag"> |
3f23cc
|
4 |
<md-list-item |
26aabc
|
5 |
@click="markCompleted()" |
3f23cc
|
6 |
> |
b03f98
|
7 |
<checkbox v-model="todoItem.completed" class="checkbox-completed"/> |
b4180d
|
8 |
|
e351bf
|
9 |
<span class="md-list-item-text" :class="{'strike-through': todoItem.completed}">{{ todoItem.title }}</span> |
D |
10 |
</md-list-item> |
|
11 |
<!-- TODO - SVG for use in Lab3 --> |
|
12 |
<md-button class="important-flag" @click="markImportant()"> |
26aabc
|
13 |
<svg :class="{'red-flag': todoItem.important}" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" ><path d="M0 0h24v24H0z" fill="none"/><path d="M14.4 6L14 4H5v17h2v-7h5.6l.4 2h7V6z"/></svg> |
6191f0
|
14 |
</md-button> |
fbee7b
|
15 |
</div> |
a34f1d
|
16 |
</div> |
D |
17 |
</template> |
|
18 |
<script> |
8acdfc
|
19 |
import Vue from "vue"; |
1f415e
|
20 |
import { Checkbox, Radio } from "vue-checkbox-radio"; |
A |
21 |
Vue.component("checkbox", Checkbox); |
|
22 |
Vue.component("radio", Radio); |
8acdfc
|
23 |
|
a34f1d
|
24 |
export default { |
D |
25 |
name: "TodoItem", |
|
26 |
props: { |
|
27 |
// type any object ;) |
|
28 |
todoItem: {} |
|
29 |
}, |
|
30 |
methods: { |
ba91cd
|
31 |
markCompleted() { |
6191f0
|
32 |
this.$store.dispatch("updateTodo", {id :this.todoItem._id}); |
9e628c
|
33 |
console.info("INFO - Mark todo as completed ", this.todoItem.completed); |
b4180d
|
34 |
}, |
A |
35 |
markImportant() { |
ba91cd
|
36 |
// TODO - FILL THIS OUT IN THE LAB EXERCISE |
e351bf
|
37 |
this.$store.dispatch("updateTodo", {id: this.todoItem._id, important: true} ); |
D |
38 |
console.info("INFO - Mark todo as important ", this.todoItem.important); |
a34f1d
|
39 |
} |
D |
40 |
} |
|
41 |
}; |
|
42 |
</script> |
|
43 |
|
|
44 |
<!-- Add "scoped" attribute to limit CSS to this component only --> |
|
45 |
<style scoped lang="scss"> |
637b4a
|
46 |
.md-list-item { |
acdeac
|
47 |
width: 320px; |
A |
48 |
max-width: 100%; |
637b4a
|
49 |
height: 50px; |
acdeac
|
50 |
display: inline-block; |
A |
51 |
overflow: auto; |
991fff
|
52 |
} |
A |
53 |
|
8acdfc
|
54 |
.md-list-item-text { |
A |
55 |
padding-left: 0.5em; |
637b4a
|
56 |
} |
A |
57 |
|
|
58 |
.itemCardandFlag { |
|
59 |
display: inline-block; |
8acdfc
|
60 |
} |
A |
61 |
|
a34f1d
|
62 |
.strike-through { |
D |
63 |
text-decoration: line-through; |
b4180d
|
64 |
font-style: italic; |
A |
65 |
} |
|
66 |
|
8a2c1e
|
67 |
.important-flag { |
637b4a
|
68 |
height: 50px; |
A |
69 |
margin: 0px; |
|
70 |
} |
b4180d
|
71 |
.red-flag { |
A |
72 |
fill: #cc0000; |
a34f1d
|
73 |
} |
D |
74 |
</style> |