Skip to content

Commit

Permalink
Emitの利用
Browse files Browse the repository at this point in the history
  • Loading branch information
aocm committed Feb 27, 2021
1 parent 20d247e commit d31abf4
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
12 changes: 10 additions & 2 deletions front/src/components/molecules/TaskItem.vue
Expand Up @@ -12,8 +12,8 @@

<q-item-section top side>
<div class="text-grey-8 q-gutter-xs">
<q-btn class="gt-xs" size="12px" flat dense round icon="delete" />
<q-btn size="12px" flat dense round icon="more_vert" />
<q-btn class="gt-xs" size="12px" flat dense round icon="delete" @click="emitDeleteButton" />
<q-btn size="12px" flat dense round icon="more_vert" @click="emitDetailButton" />
</div>
</q-item-section>
</q-item>
Expand All @@ -33,6 +33,14 @@ export default {
return {
text: ''
}
},
methods: {
emitDeleteButton () {
this.$emit('delete-emit', this.title)
},
emitDetailButton () {
this.$emit('detail-emit', this.title)
}
}
}
</script>
25 changes: 23 additions & 2 deletions front/src/components/organisms/TaskList.vue
Expand Up @@ -3,8 +3,13 @@
<q-list bordered class="rounded-borders">
<q-item-label header>Tasks</q-item-label>
<template v-for="(taskItem, index) in taskList">
<q-separator :key="index" spaced />
<task-item :key="index" :title="taskItem.title" />
<q-separator :key="`${index}+separator`" spaced />
<task-item
:key="index"
:title="taskItem.title"
@delete-emit="deleteButton"
@detail-emit="detailButton"
/>
</template>
</q-list>
<q-footer bordered class="bg-white text-primary">
Expand Down Expand Up @@ -34,6 +39,22 @@ export default {
type: Array,
default: null
}
},
data () {
return {
text: ''
}
},
methods: {
deleteButton (val) {
console.log(val)
},
detailButton (val) {
console.log(val)
},
inputEnter () {
}
}
}
</script>
4 changes: 0 additions & 4 deletions front/src/layouts/TasksLayout.vue
Expand Up @@ -32,10 +32,6 @@ export default {
name: 'TaskLayout',
components: { TaskList, MenuList },
props: {
title: {
type: String,
required: true
},
menuList: {
type: Array,
default: null
Expand Down

0 comments on commit d31abf4

Please sign in to comment.