vscode怎么debug vue项目
使用 vue create ss 创建个名为 ss 的 vue3 项目 (vue2项目不知道为什么不可以)
App.vue中添加方法和事件,并打断点
<button @click="ha">asdfasdfasdfsdf</button>
methods: {
ha() {
console.log('111111111')
console.log('222222222222')
}
}
vue.config.js 添加
configureWebpack: {
devtool: "source-map",
},
启动 npm run serve
添加 launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
}
]
}
启动调试,点击按钮会进入到调试里。