[英]Vue files dont show intellisense with javascript methods
I am running Vue 2.6 and using VSCode and my intellisense works just fine within js files, but once I try to use the intellisense from within a vue file, I lose all my intellisense.我正在运行 Vue 2.6 并使用 VSCode,而我的智能感知在 js 文件中工作得很好,但是一旦我尝试从 vue 文件中使用智能感知,我就会失去所有的智能感知。
I have the latest VSCode install and Vetur installed for working with Vue files.我安装了最新的 VSCode 和 Vetur 来处理 Vue 文件。
index.js - This is an npm package of mine that i am importing into my Vue app. index.js - 这是我的 npm package,我正在导入到我的 Vue 应用程序中。
class MyClass {
/**
*
* @param {string} str - ID of the DOM node to attach to.
* @param {boolean|Object} opt - Other options stuff here....
*/
constructor(str, opt) {}
}
export default MyClass;
new MyClass('abc', {}); <------ intellisense works here.
Page.vue页面.vue
<!--- all vue template code here -->
<script>
import MyClass from 'my-npm-package'; // This is the index.js file from my npm package.
new MyClass(); <--------------- intellisense doesnt work here ever..
export default {
mounted() {
new MyClass(); <--------------- intellisense doesnt work here either..
}
}
</script>
You need plugin for VS Code to recognize Vue syntax你需要 VS Code 的插件来识别 Vue 语法
For Vue versions 2.x plugin is Vetur对于 Vue 版本 2.x 插件是Vetur
For Vue versions 3.x plugin is Vue Language Features (Volar)对于 Vue 版本 3.x 插件是Vue 语言功能 (Volar)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.