// 在模板文件中使用$store.state.name在小程序中有bug,所有使用下面的方式
import store from '@/store/index.js'
computed: {
user() {
return store.state.user
}
},
import { mapState } from 'vuex'
computed: {
...mapState('cartjs', ['cart'])
}
海之光的个人博客// 在模板文件中使用$store.state.name在小程序中有bug,所有使用下面的方式
import store from '@/store/index.js'
computed: {
user() {
return store.state.user
}
},
import { mapState } from 'vuex'
computed: {
...mapState('cartjs', ['cart'])
}