webstorm使用技巧
1、修改模板(如vue組件模板)
file--settting--搜template--flie and code template--vue single file component
vscode使用技巧
1辩尊、新建vue組件模板是沒(méi)有內(nèi)容的涛浙,所以需要我們安裝兩個(gè)插件Vetur和 Vue VSCode Snippets
2、webstorm和vscode:JS或TS里面使用@
第一種寫(xiě)法:import HelloWorld from "../components/HelloWorld.vue";
第二種寫(xiě)法:import HelloWorld from "@/components/HelloWorld.vue";
前者寫(xiě)法后綴可以不加.vue,后者要加.vue蝗拿,建議使用第二種寫(xiě)法晾捏,這樣不需要知道文件夾外面結(jié)構(gòu)層是上一級(jí)或者上上級(jí)。第二種寫(xiě)法哀托,鼠標(biāo)移到Helloworld.vue上惦辛,按住ctrl點(diǎn)擊,就能跳轉(zhuǎn)對(duì)應(yīng)組件上內(nèi)容
3仓手、webstorm和vscode:CSS或SCSS里使用@
第一種寫(xiě)法:@import "../assets/style/test.scss";
第二種寫(xiě)法:@import "~@/assets/style/test.scss";
建議第二種寫(xiě)法胖齐,原理和JS加@一樣。不過(guò)webstorm需要單獨(dú)自配置如下:
file--settting--搜webpack--munually--找到自己目錄名字-node_modules--@vue\cli-service--webpack.config.js--點(diǎn)擊OK完成
4嗽冒、webstorm中使用TS呀伙,那router里面代碼需要加分號(hào)的,我們可以按兩次shift鍵添坊,搜reformat顯示快捷鍵剿另,操作快捷鍵就能給你的router代碼自動(dòng)配上分號(hào)。如果你發(fā)現(xiàn)不能按快捷鍵也沒(méi)有用贬蛙,你需要進(jìn)行如下配置
file--settting--搜editor--code style--typescripe--punctuation
5雨女、vue.config.js 報(bào) eslint 錯(cuò)誤怎么辦?
/* eslint-disable */
把這句話添加到 vue.config.js 的第一行即可