<template>
<div style="margin: 20px">
<h3>form父页面中添加子组件,提交按钮在父组件</h3>
<formChild ref="formChild" :formInline="formInline"></formChild>
<el-button @click="clickHome">clickHome</el-button>
</div>
</template>
<script>
import formChild from "./formChild.vue";
export default {
data() {
return {
formInline: { name: "", where: "" },
};
},
components: { formChild },
methods: {
clickHome() {
this.$refs.formChild.submitFormFather((isPassFlag, ruleForm) => {
if (isPassFlag) {
const data = {
...ruleForm,
};
//调用方法
this.axiosFun(data);
} else {
return false;
}
});
},
axiosFun(data) {
//调用接口或其他方法
console.log(data);
},
},
watch: {},
mounted() {},
crea
vue:表单在子组件(父页面中添加子组件,提交按钮在父组件)怎么处理
猜你喜欢
转载自blog.csdn.net/jieweiwujie/article/details/128582215
今日推荐
周排行