< buttonclass="p-3rounded-3xlshadow-mdfont-boldm-4px-10border-2"> How to avoid button nesting in Vue js-PHP Chinese Network Q&A
How to avoid button nesting in Vue js
P粉852114752
P粉852114752 2023-09-15 12:35:30
0
1
411

So I have a button that I want to use multiple times, as a component with a slot

But when I wanted to use it, I couldn't use @click="method" on the slot button, so I used a nested button (I had a slot button and then another button just to Use @click="method"):

This works, but it's invalid HTML. How can I solve it?

P粉852114752
P粉852114752

reply all (1)
P粉920835423

Vue3 SFC Playground

You need to usev-bind="$attrs"to bind the properties of the button component to

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!