项目运行起来的时候让浏览器自动打开出现0.0.0.0
---package.json
"scripts": {
"serve": "vue-cli-service serve --open",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
vue.config.js中添加以下代码就可以解决
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
// npm run serve在0.0.0.0打开解决办法,
// 添加开始
devServer: {
port: 8080,
host: 'localhost',
},
// 添加结束
})