Adding custom 'id' properties to dropdown elements divs in QSelect, QAutocomplete
-
Is there a simple way to add a custom id to drop-down elements in QSelect, QAutocomplete? Like, I have a drop-down list ‘cats’, ‘dogs’, ‘pigs’ and I want to add id=‘catsId’ , id=‘dogsId’, id=‘pigsId’ property to each option <div>.
Thank you!
-
What do you need it for? Maybe there is another way to get done, what you want to get done?
Scott
-
@s.molinari, for testing) In certain cases unique ids seem to be the most convenient way.
-
Well, it’s probably not the simple method you are looking for, but you are offered the scoped slot
option
, where you can design the select options as you please. I’d suggest trying that out.Scott
-
@s.molinari, yes, I’ve been trying to avoid using slots and from what you say I see this is the only way if I want to proceed with ids. Thank you!
-
Slots are a mighty powerful part of Vue. You shouldn’t avoid them. You should embrace them, as they are often used in Quasar and give you the most flexibility.
Scott