繁体   English   中英

Typescript Vue 的 VSCode 智能感知(@Component 自动导入)

[英]VSCode intellisense for Typescript Vue (Auto import at @Component)

我目前正在使用 Typescript 和 Vue 在 VSCode 中开发一个小项目。 我的 VSCode 带有以下插件 TSLint、TSLint Vue、Vetur 和 Prettier。

每当我尝试像这样从@Component 部分引用 class 时,我都无法让智能感知“自动导入”部分工作。

@Component({
  components: {
    User //Here it doesn't work
  },
})

尝试自动导入时的错误示例

但是正如您在代码中进一步看到的那样,它可以工作。

import User from '@/models/user';

@Component({
  components: {
    User //Here it doesn't work
  },
})
export default class Project extends Vue {
  user: User = new User(); //Here i can get the intellisense to auto import "User"
}

智能感知工作正常的示例

是因为人手不足,所以不能引用吗?

好吧,我想我只是 go 没有速记“用户:用户”的解决方案

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM