Topic: How to set the value of a form selector inside setup()
NoahConn pro asked 2 years ago
Expected behavior
When the select component renders, I want to set the displayed value based on data from vuex.
Actual behavior
When the select component renders, it reverts to the first option in the 'v-model:options' and the only way to programmatically set the value described in the documentation is within the template and requires user interaction.
Resources (screenshots, code snippets etc.)
Documentation Reference: https://mdbootstrap.com/docs/b5/vue/forms/select/#section-set-value
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Opened
- ForumUser: Pro
- Premium support: No
- Technology: MDB Vue
- MDB Version: MDB5 1.4.0
- Device: Macbook Pro 2017
- Browser: Chrome
- OS: macOS Big Sur
- Provided sample code: No
- Provided link: Yes
Mikołaj Smoleński staff commented 2 years ago
Do you add the
selected
key to the option while parsing data from vuex? If not, then you will have to set the value programatically as described in the mentioned section.Keep coding, Mikołaj from MDB