利用hook进行监听子组件生命周期,其中mouted是其生命周期名:
<template>
<div>
<child @hook:mounted="childMountedEvent" style="color:red"></child>
</div>
</template>
<script>
import child from "@/views/debug/child.vue";
export default {
name: 'model',
data() {
return {
};
},
methods: {
childMountedEvent(e){
console.log('childMountedEvent',e)
}
},
created() {},
computed: {},
components: {child},
};
</script>