11.3 Connect Search Bar to Vuex State with mapState
This commit is contained in:
parent
cbd65f1b0c
commit
9f7b4f75e6
@ -16,11 +16,14 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'Search',
|
||||
data () {
|
||||
return {
|
||||
searchField: ''
|
||||
computed: {
|
||||
...mapState('tasks', ['search']),
|
||||
searchField () {
|
||||
return this.search
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,8 @@ const state = {
|
||||
dueTime: '16:30'
|
||||
}
|
||||
*/
|
||||
}
|
||||
},
|
||||
search: ''
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
|
Loading…
Reference in New Issue
Block a user