Use axios to request, really fragrant
axios.get(' http://api.fanyi.baidu.com/api/trans/vip/translate?q=apple&from=en&to=zh&appid=2015063000000001&salt=1435660288&sign=f89f9594663708c1605f3d736d01d2d4 ') .then((response) => { console.log(response); }) .catch((error) => { console.log(error); })
Resolve cross domain requests
module.exports = { dev: { proxyTable: {} } }
proxyTable: { '/api': { target: ' https://www.barben.cn ',//Write the domain name and port of the interface to be called, and remember to add http. changeOrigin: true, pathRewrite: { '^/api': ''//It is understood here that/api is used to replace the address in the target, and/api is used directly when calling the interface. For example, I want to call https://www.barben.cn/request/ts Interface, just write/api/request/ts directly. } } }