Topic: mdb-select model
Aik_Boba free asked 4 years ago
Hi, guys! :) So, I want to make another proposition. I think it will be better to use v-model for native purposes. I mean v-model should relates current VALUE data between component and template, not OPTIONS LIST. Look at primary source: https://vuejs.org/v2/guide/forms.html And you support native v-model schema on inputs. So why you doesn't do in this case?) No needs in "selected" event. And list, for my opinion, better do with custom . Because as developer, I don't want to be depend on {value: .. text: .. selected..} structure.
This is my opinion and you can ignore my poropose. Have a nice day! Thanks :)
Closed
This topic is closed.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Closed
- ForumUser: Free
- Premium support: No
- Technology: MDB Vue
- MDB Version: 6.3.0
- Device: any
- Browser: any
- OS: any
- Provided sample code: No
- Provided link: Yes
Mikołaj Smoleński staff commented 4 years ago
Right, but what with multiselect case? There were many requests to use such structure, because some developers need to get also text value from it. In addition, choosing default values would be problematic if we want to store data in one object, i.e. downloaded from an API (not by selecting each option manually).
Best regards
Aik_Boba free commented 4 years ago
For multiselect case - Array :)For default value case - vice versa. I mean you should use prop as String prop for single select and as Array - for multiselect (and set selected options over the Object.filter(...)). Btw, you can use multiple possible props types.To get text value you can use $ref functionality or set :onchange(e => {e.target...}) listener
But, ok. Thanks for your answer! :)
Mikołaj Smoleński staff commented 4 years ago
Thanks for your remarks.
Best regards