1. 在线上建立一个分支~index-ajax
2. 将线上分支拉到本地
3. 安装axios ~ 启动项目
import axios from 'axios'
methods:{
getMyHeader () {
axios.get('/api/index.json')
.then(this.getHeaderSucc)
},
getHeaderSucc (res) {
console.log(res)
}
},
mounted () {
this.getMyHeader()
}
proxyTable: {
'/api':{
target: 'http://localhost:8080',
pathRewrite:{
'^/api': '/static/mock'
}
}
}