实现效果
window点击ctrl(MAC点击command)+通过import引入的文件,方法等等,跳转启定义的页面
在项目根目录新建文件jsconfig.json
{
"compilerOptions": {
"target": "es6",
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
}
},
"exclude": ["node_modules", "dist"],
"include": ["src/**/*"],
"vueCompilerOptions": {
"experimentalCompatMode": 2
}
}
添加完要重新运行一下。
注意: 如果点不进去, 看一下是不是有完整地表示了文件名或者对比一下文件位置正不正确。
比如:import Picture from '@/components/Picture'
这种情况当点击Picture它不会跳,要完整表达
改成:
import Picture from '@/components/Picture/index.vue'
或者这样的情况也是点击不进去的,比如说,
import Picture from '@/components/Picture/index'
一定要完整表达,.vue也要加上,文件名要写完整。
import Picture from '@/components/Picture/index.vue'