[Vuejs]-How to pass rest of the properties which are not defined as props to a component in Vue?

1👍

you can pass it using fall through($attrs) attribute as below:

<button v-bind="$attrs">{{text}}</button>

Also you can have all event handlers for the custom-button with assigning $listners like this:

<button v-on="$listeners" v-bind="$attrs">{{text}}</button>

Therefore you can use custom-button component like this:

<custom-button text="Open" title="Open" class="w-100" @click="handler" @mousemove="handler"></custom-button>

Leave a comment