这个错误通常是因为您在将数据传递给 Vue 组件时,将 'store' 属性添加到了 VNodeData 对象中,但是该属性不是 Vue 组件所支持的标准属性。

解决方案是将 'store' 属性从 VNodeData 对象中删除,并将其传递给 Vue 实例或 Vue 组件的 props 属性中。例如:

// 错误的代码
const myComponent = {
  render(h) {
    return h('div', { store: myStore }, 'My Component')
  }
}

// 正确的代码
const myComponent = {
  props: {
    store: {
      type: Object,
      required: true
    }
  },
  render(h) {
    return h('div', 'My Component')
  }
}

new Vue({
  el: '#app',
  render(h) {
    return h(myComponent, { props: { store: myStore } })
  }
})

在上面的代码中,我们将 'store' 属性从 VNodeData 对象中删除,并将其传递给 Vue 组件的 props 属性中。这样做可以避免 'store 不在类型 VNodeData 中' 的错误。

Vue.js 错误:'store' 不在类型 'VNodeData' 中 (ts(2769)) - 解决方法

原文地址: http://www.cveoy.top/t/topic/miNo 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录