采用vue-cli構(gòu)建項目,接口轉(zhuǎn)發(fā)如下proxyTable: { '/api': { target: 'http://abcd.com/api', changeOrigin: true, pathRewrite: { '^/api': '' } } }在開發(fā)環(huán)境下,配置了這個,可以解決在開發(fā)環(huán)境下的跨域請求,那么在生產(chǎn)環(huán)境下 通過 npm run build打包之后,這一塊的問題vue-cli會自己處理嗎?在生產(chǎn)環(huán)境下還需要注意什么東西?求大神解答axios.post('api/auth/register', { 'firstname':this.firstname, 'lastname':this.lastname, 'email':this.email, 'password':this.password, 'password_confirmation':this.configPassword }) .then(function (response) { console.log(response.data); }) .catch(function (error) { console.log(error); });假設(shè)請求如上api(生產(chǎn)環(huán)境沒有跨域),在本地配置接口轉(zhuǎn)發(fā)之后可以請求到數(shù)據(jù),那么在生產(chǎn)環(huán)境應(yīng)該要怎么樣?直接打包之后,將資源放在服務(wù)器嗎?
vue-cli 本地接口轉(zhuǎn)發(fā)
慕森王
2018-11-07 14:15:12