Bil*_*hia 6 typescript vue.js vuex
我在我的项目中使用 vue.js 3、typescript 和 vuex 4。this.$store但是在我的.vue文件上使用时出现此错误
Property '$store' does not exist on type 'CreateComponentPublicInstance<{}, {}, { exchanges: Exchange[]; isValidNodeUrl: boolean; isValidSelectedNetworks: boolean; web3: "" | Web3; privateKey: string; jsonKeystore: string; jsonKeystorePassword: string; ... 24 more ...; botIsRunning: boolean; }, ... 14 more ..., {}>'
Run Code Online (Sandbox Code Playgroud)
vuex.d.ts我根据此文档
添加了内容,但仍然遇到相同的错误https://next.vuex.vuejs.org/guide/typescript-support.html。
import { Store } from "vuex";
import { ComponentCustomProperties } from "vue";
import { State } from "@/interfaces/bot";
declare module "@vue/runtime-core" {
// Declare your own store states.
interface ComponentCustomProperties {
$store: Store<State>;
}
}
Run Code Online (Sandbox Code Playgroud)
有人可以帮助我吗?
| 归档时间: |
|
| 查看次数: |
3260 次 |
| 最近记录: |