第一步: 新建模板並保存vue
文件 --> 首選項 --> 用戶代碼片斷 --> 輸入vue,選擇vue.json -->複製 第三步中的模板內容中內容保存web
第二步: 添加配置,讓vscode容許自定義的代碼片斷提示出來json
文件 --> 首選項 --> 設置 ---> 添加這2項ecmascript
// Specifies the location of snippets in the suggestion widget "editor.snippetSuggestions": "top", // Controls whether format on paste is on or off "editor.formatOnPaste": true
第三步: 複製如下代碼,保存重啓vscodewebstorm
{ "Print to console": { "prefix": "vue", "body": [ "<template>", " <div class=\"page\">\n", " </div>", "</template>\n", "<script type=\"text/ecmascript-6\">", "export default {", " data() {", " return {\n", " }", " },", " components: {\n", " }", "}", "</script>\n", "<style scoped lang=\"stylus\">", "</style>", "$2" ], "description": "Log output to console" } }
第四步:測試是否添加成功測試
測試方法: 新建vue後綴文件,輸入vue,按下tab鍵,OKcode
缺點是:沒法像sublime同樣新建一個vue文件就能夠自動帶上對應的模板。component
吐槽一下:webstorm中,中文輸入法兼容有問題,據傳是Microsoft .NET Framework 4.5.2以上版本的兼容問題,更換屢次版本後沒法修復。無奈只能換到vscodeorm