html部分
删除 提交 新增域名 重置
js部分
export default { name: "fromdatadt", data() { return { dynamicValidateForm: { domains: [ { name: "", age: "", six: "" } ], email: "", qq: "", tel: "" } }; }, methods: { submitForm(formName) { console.log(JSON.stringify(this.dynamicValidateForm)); }, resetForm(formName) { this.$refs[formName].resetFields(); }, removeDomain(item) { var index = this.dynamicValidateForm.domains.indexOf(item); if (index !== -1) { this.dynamicValidateForm.domains.splice(index, 1); } }, addDomain() { this.dynamicValidateForm.domains.push({ name: "", age: "", six: "", key: Date.now() }); } }};
提交如下: