v-bind="$attrs" v-on="$listeners" vue 中的个人 insight-B 组件
最编程
2024-05-21 15:26:47
...
<template>
<div>
<C v-bind="$attrs" v-on="$listeners" ></C>
</div>
</template>
<script>
import C from './C.vue'
export default {
name: 'B',
components: {
C
},
props: {
a: String
},
data () {
return {
}
},
created () {
console.log('this.$attrs', this.$attrs)
// b: b this.$attrs 只会输出不在props中传递的属性
},
methods: {
}
}
</script>