11.3 Connect Search Bar to Vuex State with mapState

This commit is contained in:
Fredrick W Warren 2021-02-10 12:23:29 -08:00
parent cbd65f1b0c
commit 9f7b4f75e6
2 changed files with 8 additions and 4 deletions

View File

@ -16,11 +16,14 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex'
export default { export default {
name: 'Search', name: 'Search',
data () { computed: {
return { ...mapState('tasks', ['search']),
searchField: '' searchField () {
return this.search
} }
} }

View File

@ -23,7 +23,8 @@ const state = {
dueTime: '16:30' dueTime: '16:30'
} }
*/ */
} },
search: ''
} }
const mutations = { const mutations = {