解決跨域問題
h5 發請求會報跨域問題,需要使用代理轉換請求。
編輯根目錄下的 config/index.js 文件
h5: {
devServer: {
host: 'localhost',
port: 10086,
proxy: {
'/api/v1': {
target: 'http://localhost:8000', // 服務端地址
changeOrigin: true
}
}
},
}