1. 程式人生 > >VScode自定義程式碼片段

VScode自定義程式碼片段

開啟VScode

  • 進入 snippet 設定檔案,這裡提供了兩種方法: 
    • 摁「Alt」鍵切換選單欄,通過檔案 > 首選項 > 使用者程式碼片段,選擇進入目的語言的程式碼段設定檔案;
    • 通過快捷鍵「Ctrl + Shift + P」開啟命令視窗(all command window),輸入「snippet」,通過候選欄中的選項進入目的語言的程式碼段設定檔案。
  • 填寫 snippets

vue:

 {

"Print to console": { "prefix": "vue", "body": [ "<!-- $0 -->", "<template>"
, " <div></div>", "</template>", "", "<script>", "export default {", " data () {", " return {", " };", " },", "", " components: {},", "", " computed: {},"
, "", " mounted: {},", "", " methods: {}", "}", "", "</script>", "<style scoped>", "</style>" ], "description": "Log output to console" }

}