在vue項目根目錄下新建vue.config.js,添加如下內(nèi)容
module.exports={
devServer: {
port: 8000, // 端口號
host: 'localhost',
https: false, // https:{type:Boolean}
open: true, //配置自動啟動瀏覽器
proxy: 'http://localhost:58156' // 配置跨域處理,只有一個代理
}
}
其他配置細(xì)節(jié)還要參考官方文檔
官網(wǎng):https://cli.vuejs.org/
配置:https://cli.vuejs.org/config/#devserver