按照网上的方法,修改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)
})
}
},页面报错如下

达令说
随时随地看视频慕课网APP
相关分类