【发布时间】:2021-02-08 13:58:19
【问题描述】:
我在应用程序中使用 typescript vue,我有这个错误来自一个组件,我尝试访问像这样传递到路由中的参数
properties = getModule(PropertiesModule, this.$store);
mounted() {
id = this.$router.history.current.params.id;
this.properties.getProperty(id);
}
get months() {
return this.$store.state.app.months;
}
get property() {
return this.$store.state.properties.property;
}
}
代码运行得非常好,因为据我所知,这不是违规行为。但打字稿仍然抛出错误。我尝试使用 es-lint disable-next-line 但它不起作用。我还尝试在我的 main.ts 中为路由器指定 any 类型,但效果不佳。 有没有比这更好的方法来访问 vue.js 中的路由器参数?
【问题讨论】:
标签: typescript vue.js vue-router eslint typescript-typings