Topic: Load multi select options from API

wizedkyle priority asked 1 year ago


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 1 year 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!



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Vue
  • MDB Version: MDB5 3.1.1
  • Device: macOS
  • Browser: Chrome
  • OS: Ventura
  • Provided sample code: Yes
  • Provided link: Yes