最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Vue使用Post進行表單提交

 更新時間:2022年06月01日 11:10:40   作者:海濤高軟  
這篇文章主要介紹了Vue使用Post進行表單提交,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教

使用Post進行表單提交

下面就是使用Vue提交表單的方法

submitForm(event) {
					event.preventDefault();
					let formData = new FormData();
					formData.append('id', this.param.id);
					formData.append('categoryName', this.param.namee);
					formData.append('description', this.param.descrip);
					var url ="";
					if(this.isSave){
						url = "http://localhost:8080/bookStore/category.do?flag=add"
					}else{
						url = "http://localhost:8080/bookStore/category.do?flag=update&id="+this.param.id
					}
					this.$http.post(url, formData).then(function (res) {
					  if (res.status === 200) {
						  this.isShowModal=false;
						  var title = this.isSave?"添加成功!":"修改成功!";
						  swal({title:title,text:"",type:"success"});
						  this.queryData();
						  this.clearData();
					  }
					})
				}

vue中使用Post問題

get的使用

this.$axios.get("/api/Main/InputValue",{
? ? ?params:{ //傳參
? ? ? ? ?json:"123"
? ? ?}
})
.then(function(res){
? ? ?//console.log(res) ? ? ? ? ?
})
.catch(function(err){
? ? ? console.log("請求失敗233");
});

post的使用

this.$axios.post("/api/Main/posttest",{json:"123"})//傳參
.then(function(res){
? ? ? console.log(res) ? ? ? ? ?
})
.catch(function(err){
? ? ? console.log("請求失敗233");
});

post和get傳參數(shù)的方式是不一樣的,寫post的時候如果在params里面?zhèn)鲄?shù),后臺是收不到的~~~~ 

以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

海原县| 新余市| 广饶县| 奉化市| 刚察县| 汉中市| 连南| 大渡口区| 光山县| 资阳市| 武山县| 祥云县| 郴州市| 临猗县| 屯门区| 锡林郭勒盟| 根河市| 谢通门县| 栾城县| 唐河县| 兴宁市| 阿克陶县| 五台县| 定州市| 文成县| 东城区| 闵行区| 萍乡市| 新泰市| 灵川县| 贡嘎县| 大同市| 麟游县| 新乐市| 天全县| 玛曲县| 怀柔区| 恩施市| 新乡县| 永和县| 滨海县|