vue的$http的get請(qǐng)求要加上params操作
vue GET傳遞參數(shù)要加上params
this.$http.get(’/operation/customer/question/edits’,{params:{id: 10}})
另外說(shuō)一句,現(xiàn)在VUE官方推薦使用axios
vue-resource不更新了
補(bǔ)充知識(shí):vue請(qǐng)求中 post get傳參方式是不同的哦
我在學(xué)習(xí)vue,項(xiàng)目中post請(qǐng)求,get請(qǐng)求都用到了,我發(fā)現(xiàn)傳參方式是不一樣的。
post請(qǐng)求的例子:
checkin (){this.$http.post(’my url’,{mobilePhone:this.phone,password:this.password},{emulateJSON: true}).then(function(res){this.$root.userid=res.data.userid;console.log(this.$root.userid)this.$router.push(’/content’) ;});}
get請(qǐng)求的例子:
nextOne2 (){this.$http.get(’http://192.168.100.31:8080/wenchuang/guid/addProductFile’,{params: {filename:this.formData.chanpinjia,userid: this.$root.userid},},{emulateJSON: true}).then(function(res){this.step++;this.bianliang= res.data.files.id;});},
以上這篇vue的$http的get請(qǐng)求要加上params操作就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. python實(shí)現(xiàn)感知機(jī)模型的示例2. 基于Django集成CAS實(shí)現(xiàn)流程詳解3. springboot多模塊包掃描問(wèn)題的解決方法4. Android Studio編寫(xiě)AIDL文件后如何實(shí)現(xiàn)自動(dòng)編譯生成5. 自定義Django默認(rèn)的sitemap站點(diǎn)地圖樣式6. 基于vue實(shí)現(xiàn)探探滑動(dòng)組件功能7. 深入淺出 妙用Javascript中apply、call、bind8. windows下安裝PHP性能分析工具 xhprof 筆記9. iOS UIScrollView和控制器返回手勢(shì)沖突解決方法10. django中url映射規(guī)則和服務(wù)端響應(yīng)順序的實(shí)現(xiàn)
