1.在config中的index.js中配置:
proxyTable: {
'/api': {
target: 'http://localhost:8080',
pathRewrite: {
'^/api': '/static/mock'
}
}
2.组件中使用
this.$axios.get('/api/data.json')
.then((res) => {
this.seller = res.data.seller
console.log(res)
})
网友评论