Topic: Load multi select options from API
I am trying to generate a multi select options from an API but I am having a hard time adding the API response data to the object.
The api returns the following structure:
scopes: [
"scope1",
"scope2",
....
]
I am hard coding const retrievedScopes = ref([{ label: "scope1", value:"scope1' }])
but I would like to automatically generate this from the API response.
Would anyone have any examples on how to generate this?
Bartosz Cylwik staff answered 2 years ago
Hi, I made a snippet, where after some time I am changing option data inside a onMounted
hook. You can check if any of that would be helpfull
https://mdbootstrap.com/snippets/vue/b-cylwik/5023433#js-tab-view
Best Regards!
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: Yes
- Technology: MDB Vue
- MDB Version: MDB5 3.1.1
- Device: macOS
- Browser: Chrome
- OS: Ventura
- Provided sample code: No
- Provided link: Yes