Vue.$http全局配置
全局配置数据接口的根域名
Vue.http.options.root = 'http://vue.studyit.io/'
getAllList() {
this.$http.get('api/getprodlist').then(result =>{
var result = result.body
if (result.status === 0) {
this.list = result.message
}else{
alert('获取数据失败!')
}
})
}
}
全局配置emulateJSON
Vue.http.options.emulateJSON = true
add() {
this.$http.post('api/getprodlist', { name: this.name }).then(result =>{})
},