父组件:
<template>
<view>
<!-- 列表 -->
<inspection-form ref="InspFrom" @SelectAll="SelectAll2" :formObj="formObj" :key="Listkey" />
</view>
</template>
<script>
import InspectionForm from '@/pages/pagesA/components/form/InspectionForm'
export default {
components: {
InspectionForm,
},
data() {
return {
formObj:{},
}
},
methods: {
// 别的页面传递过来的值,改变that.formObj里面的值
OnCntrno2(num){
let that =this
that.formObj.cntrno = num
console.log(that.formObj)
that.Listkey = new Date().getTime()
}
}
}
</script>
<style>
</style>
子组件:
props: {
formObj: {
type: Object,
required: false
},
},
watch: {
formObj: {
deep: true,
immediate: true,
handler(val) {
let that = this
if (val) {
that.ObjFrom = val
that.loadDate()
}
}
}