下面就是使用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();
					  }
					})
				}

 

FR:徐海涛(hunk Xu)
QQ技术交流群:386476712

 

 

Logo

前往低代码交流专区

更多推荐