【问题标题】:How to declare types for Vuex bindings on Vue component?如何在 Vue 组件上声明 Vuex 绑定的类型?
【发布时间】:2019-01-01 11:35:24
【问题描述】:

我在 Vue 组件上使用 Vuex mapState(使用 Vue.extend,不是类样式):

  computed: {
    ...mapState('geoframes/create', [
      'apiRequestId',
      'countPending',
      'deviceCount',
      'requestId',
    ]),

例如,Vue 组件中引用 this.deviceCount 的方法会引发 TS 错误,因为它没有意识到这些是通过 Vuex 绑定到组件的。

我该如何解决这个问题?

【问题讨论】:

    标签: typescript vue.js vuex


    【解决方案1】:

    事实证明这实际上是 Vuex 中的一个错误。

    https://github.com/vuejs/vuex/issues/1353

    【讨论】:

      猜你喜欢
      • 2017-07-08
      • 2021-10-30
      • 1970-01-01
      • 2021-09-08
      • 2021-04-25
      • 2021-06-20
      • 2018-06-24
      • 2018-04-17
      • 2018-08-22
      相关资源
      最近更新 更多