<template>
<childCom v-bind="$attrs" v-on="$listeners" />
<!--
等价
<childCom aaa="123" @bbb="()=>{}" />
-->
</template>
<script>
export default {
name: 'Index',
mounted() {
// this.$attrs:父组件传入的,所有未被props接收的属性(json对象)
console.log(this.$attrs)// {aaa:123}
// this.$listeners:父组件传入的,所有非native事件(json对象)
console.log(this.$listeners)// {bbb:()=>{}}
}
}
</script>
<style scoped>
</style>