radix-vue / shadcn-vue

Vue port of shadcn-ui
https://www.shadcn-vue.com/
MIT License
4.56k stars 262 forks source link

[Bug]: using v-bind with $attr is not necessary #106

Closed maelp closed 11 months ago

maelp commented 11 months ago

Environment

Developement/Production OS: Windows 10 19043.1110
Node version: 16.0.0
Package manager: pnpm@8.6.0
Radix Vue version: 1.0.0
Shadcn Vue version: 1.0.0
Vue version: 3.0.0
Nuxt version: 3.0.0
Nuxt mode: universal
Nuxt target: server
CSS framework: tailwindcss@3.3.3
Client OS: Windows 10 19043.1110
Browser: Chrome 90.0.4430.212

Link to minimal reproduction

none

Steps to reproduce

I had a bug with shadcn in some circumstance where there was an issue binding $attr, and I checked with ChatGPT (😅) and it said that in vue3 it's no longer needed to use

v-bind="{ ...props, ...emitsAsProps, ...$attrs }"

since it's automatically included in v-bind

Describe the bug

remove $attr

Expected behavior

No response

Conext & Screenshots (if applicable)

No response

zernonia commented 11 months ago

It depends yaa.. if the root component is the desired component, we dont need v-bind $attrs. In many case the root component is not the desired element to bind the attrs, thus we use v-bind.