按照网上的方法,修改config下的index.js 配置请求地址,还是请求失败
config下的index.js代码如下:
proxyTable: {
'/api/**':{
target: 'http://api.jisuapi.com',
changeOrigin: true,
pathRewrite:{
'^/api': ''
}
}
},
axois请求代码如下:
const actions = {
getList ({commit}, msg){
const start = Math.floor(Math.random() * 100)
if (msg.channel && msg.type && msg.flag) {
axios.get('/api/news/get?channel=' + msg.channel + '&start='+ start +'&num=10&appkey=272f8fcb40a13a6e')
.then(res =>{
commit('GET_NEWSLIT',{
data: res.data.result.list,
kind: msg.type
})
console.log(res.data)
})
}
},
页面报错如下
先感谢各位的回答!!!
服务器路径直接访问都是404
不是你配置有问题,是接口本来就不存在,或者你传参有问题。
https://api.jisuapi.com/news/get 路径是404