Good practice? Is it naughty to use v-bind="myAttrs" to append attributes?

OK let’s say I want to add common attributes to several elements. Is it wrong to put them in an object and use v-bind to drop them in?

Just occurred to me when I was converting some react that used {…props} to drop some props in.

I wouldn’t exactly say it’s an anti-pattern. The main downside I could foresee is that should anyone join your project and is not familiar with Vue it wouldn’t be immediately apparent as to what’s going on. But that could probably be solved with better naming. e.g. attributes

1 Like

Nothing wrong with that, don’t worry.

1 Like