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. IntelliJ IDEA2020.2.2創(chuàng)建Servlet方法及404問(wèn)題2. docker /var/lib/docker/aufs/mnt 目錄清理方法3. Python的Tqdm模塊實(shí)現(xiàn)進(jìn)度條配置4. Python 多線程之threading 模塊的使用5. Python中Selenium模塊的使用詳解6. Python基于smtplib模塊發(fā)送郵件代碼實(shí)例7. CSS代碼檢查工具stylelint的使用方法詳解8. IDEA巧用Postfix Completion讓碼速起飛(小技巧)9. Python如何批量獲取文件夾的大小并保存10. CSS3中Transition屬性詳解以及示例分享
