[你好,我正在研究nuxt.js,vuetify。当使用vuex'无法读取未定义的属性'value'时,发生错误。'

问题描述 投票:0回答:1

app.vue

<script>
export default {
  methods: {
    updateDamageEnh(e) {
      this.$store.commit('simulating/updateDamageEnh', e.target.value)
    },
  },
  computed: {
    damageEnh: {
      get() {
        return this.$store.state.simulating.damageEnh
      },
      set(value) {
        this.$store.commit('simulating/updateDamageEnh', value)
      }
   },
}
</script>

vuex,simulating.js

export const state = () => ({
  damageEnh: 1,
});

export const mutations = {
  updateDamageEnh(state, damageEnh) {
    state.damageEnh = damageEnh;
  }
};


// When changing v-text-field values.
// error message
TypeError: Cannot read property 'value' of undefined

更改后的值必须在文本字段中显示,并在其他组件中重复使用。

值已更改,但是将其重定向到错误页面。

我不知道我错过了什么。谢谢

vue.js vuex vuetify.js nuxt
1个回答
最新问题
© www.soinside.com 2019 - 2024. All rights reserved.