用vue-cli搭的脚手架,
现在有api,但是他有个参数
{"CatId":238,"Similar":false,"Trend":false,"IsNew":false,"Sales":true,"SuppNo":"LKN","SuppCatId":0}
http://116.62.33.192:66/product/getproductdetaillist
照网上axion那么写不知道参数要写在哪里,
'/api': {
target:'http://116.62.33.192:66/product/getproductdetaillist',
changeOrigin:true,
pathRewrite:{
'^/api': '/api'
}
}
let postData = {'CatId': 238, 'Similar': false, 'Trend': false, 'IsNew': false, 'Sales': true, 'SuppNo': 'LKN', 'SuppCatId': 0}
export default {
methods: {
jsonpData: function () {
this.$axios.post('/api', postData)
.then(res => {
console.log(res)
})
.catch(err => {
console.log(err)
})
}
}
}
这么写他报404,不这么写,他报405.
呼如林
喵喵时光机
随时随地看视频慕课网APP
相关分类