配置代码片段
步骤如下:
- 文件->首选项->配置用户代码片段
- 新增全局代码片段
- 起全局代码片段文件名“xxx.code-snippets”
这里以配置vue2初始代码片段为例,配置具体代码片段
{"name": "vue-sph","version": "0.0.0","private": true,"type": "module","scripts": {"dev": "vite --open","build": "vite build","preview": "vite preview"},"dependencies": {"vue": "^3.4.15"},"devDependencies": {"@vitejs/plugin-vue": "^5.0.3","vite": "^5.0.11"}
}
- 测试,新建一个vue文件,开始输入vue,vscode会有提示
浏览器自动打开
package.json中scripts添加 ‘–open’