Loading

vue3中在".vue"文件中使用使用"$store"报警告问题

问题

使用最新版的vuex后,然后vue3在template模版中使用出现红色警告,但是编译无异常

效果图

解决办法:
shims-vue.d.ts文件中新增下面的声明

// shims-vue.d.ts
import { Store } from '@/store'
declare module '@vue/runtime-core' {
  interface ComponentCustomProperties {
    $store: Store
  }
}

资料链接

posted @ 2022-09-16 23:21  ^Mao^  阅读(621)  评论(0编辑  收藏  举报