Vue进行Post表单提交
下面就是使用Vue提交表单的方法submitForm(event) {event.preventDefault();let formData = new FormData();formData.append('id', this.param.id);formData.append('categoryName', this.pa...
·
下面就是使用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
更多推荐
已为社区贡献6条内容
所有评论(0)