0๐
- your data section looks incorrect. It should look like this:
data() {
return {
defaultSelected: this.items[0]
}
},
- In mapState you should indicate state props (and their module name if they are not from the root state). I assume that carDetail.js is a store module.
computed () {
...mapState({
id: state => state.cartDetail.id,
items: state => state.cartDetail.items
}),
setDefaultSelected () {
return this.items[0];
},
},
Source:stackexchange.com