iview 表单提交
表单提交知识小结
·
表单提交及其他请求参数及响应效果:
1.代码
let formData = new FormData();
formData.append("username", this.form.userName);
formData.append("password", this.form.password);
2.请求效果
3.其他请求方式的对比
a.data传参
data: {
name:this.editForm.name,
title:this.editForm.title,
basepath:this.editForm.basepath,
status:this.editForm.status,
description:this.editForm.description,
}
响应效果:
b.params传参
params: {
name:this.editForm.name,
title:this.editForm.title,
basepath:this.editForm.basepath,
status:this.editForm.status,
description:this.editForm.description,
}
响应效果
4.具体测试
getSign() {
let formData = new FormData();
formData.append("name", this.editForm.name);
formData.append("title", this.editForm.title);
formData.append("basepath", this.editForm.basepath);
formData.append("status", this.editForm.status);
formData.append("description", this.editForm.description);
this.$axios
.request({
url: "/sys/save",
method: "post",
data: formData
})
.then(res => {
if (res.data.msg) {
this.$Message.success("保存成功");
} else {
this.$Message.error(res.data.status.message);
}
});
},
基础知识,简单小结,贴出探讨,多多交流。
更多推荐
已为社区贡献3条内容
所有评论(0)