尝试在手表中调用vuex getter

时间:2019-06-13 03:07:21

标签: vue.js vuex getter watch

我正在尝试在组件表中调用Vuex getter。 但是它告诉我,未定义的不是。 因此,我尝试在计算对象中返回吸气剂,但仍然无法正常工作。

        name: "FreeTalk",
        computed: {
            ...mapGetters(['getCharacter','getResultStatus', 'getFreeTalkText', 'getResult', 'freeTalkResult', 'getFreeTalkNoNative', 'getFreeTalkMedium','getFreeTalkNative']),
            progressStatus() {
                return this.getResult.progress
            },
            getStatus() {
                return this.getResultStatus
            }
        },
        watch: {
            progressStatus: (val) => {
                if (val == 100) {
                    this.status = this.getStatus()
                    if (this.getStatus === 0) {
                        this.outputText = this.getFreeTalkNoNative.result;
                    } else if (this.getStatus === 1) {
                        this.outputText = this.getFreeTalkMedium;
                    } else if (this.getStatus === 2) {
                        this.outputText = this.getFreeTalkNative;
                    }
                }
            }
        },
        data() {
            return {
                outputText: '',
                ready: false,
                isRecordDone: false,
                status: -1
            }
        }
    }

0 个答案:

没有答案