用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.
vue-cli腳手架搭頁面,axios請求帶參數的api,怎么請求。
呼如林
2019-03-12 13:15:25