undefinedfix
Sign in

Why can't the second call trigger the getters method

Murlakatam edited in Sat, 02 Jul 2022

export default {

data () {
    return {
        items: this.$store.getters['webui/getDashboardOptions'], // 这里调用没有问题,能够触发到getDashboardOptions
        fullScreen: false
    }
},
computed: {
    activeStation () {
        return this.$store.getters['webui/activeStation']
    },
    stationData () {
        return this.$store.getters['station/stationDataPivot']
    }
},
watch: {
    stationData (newValue, oldValue) {
        this.items = this.$store.getters['webui/getDashboardOptions'] 
        // 这里如果有数据刷新,触发不了
    },
1 Replies
MenInTheMiddle
commented on Sat, 02 Jul 2022

The second call executes this when the stationdata changes . items = this .$ store . getters [' webui / getDashboardOptions '] ; If you want items and this .$ store . getters [' webui / getDashboardOptions '] Binding, you can change items to calculated

lock This question has been locked and the reply function has been disabled.