传值:
<el-input v-model="form.input" placeholder="请输入内容"></el-input>
watch: {
form() {
console.log(this.form);
① this.$emit("getVal", this.form);
},
deep: true,
immediate: true,
},
AAAA() {
② this.$emit("getVal", this.form);
},
接收值
<szcTest :collapse="true" @getVal='getVal2' ></szcTest>
methods: {
getVal2(a){
this.szc = a;
console.log(a.input)
},
…
…
…
…
调用函数
<testFrom ref="children" :lists="lists" @getVal="aaa"></testFrom>
methods: {
aaaa() {
this.$refs.children.recover(); // 调用子组件的方法
},