I am currently in the process of migrating my Vue 2 application to Vue 3. According to the official documentation, the $listeners object has been removed in Vue 3 and event listeners are now part of $attrs. This includes taking non-prop attributes like class and style into account. In my Vue 2 application, I have a custom icon-button component that looks like the code snippet below:
Icon-component:
<template>
<vu-button v-bind="buttonProps"
:class="buttonClass"
v-on="$listeners"
@click="buttonToggle">
<vu-icon v-bind="iconProps"><slot/></vu-icon>
</vu-button>
</template>
This component is utilized in various other components.
Parent component 1:
<vu-icon-button id="sw1" medium style="left:200px;">home</vu-icon-button>
Parent component 2:
<vu-icon-button class="menu-detail-btn" icon="collapse_menu" icon-type="su" @click="openModal()" size="small"></vu-icon-button>
In terms of migration strategy, I have already removed the $listeners but I'm uncertain about how to handle those non-prop attributes and the v-bind tag. How can I modify them so they can be used in parent components with attributes?