在vs code中设置console.log快捷键

4,115 阅读1分钟
  1. 在VScode中打开文件 → 首选项 → 用户代码片段 → 在搜索框中搜索 JavaScript 选择 JavaScript.json
  2. 然后我们在其中添加这样一段代码就好了
"Print to console": {
		"prefix": "log",
		"body": [
			"console.log('$1');",
			"$2"
		],
		"description": "Log output to console"
}

接下来我们只要在平时使用时输入 log +Tab 键就能快速打出 console.log()了。