Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!

siacomputacion free asked 5 years ago


select search

You have some example of how to fill a select with the information of a database table and save the selected data in another I'm working with vuejs

A greeting


Mikołaj Smoleński staff answered 5 years ago


Hi there,

Here's the example code of API select data using axios package:

<mdb-select v-model="axiosOptions" label="Choose country"/>

registering data:

  data() {
    return {
      axiosOptions: []
    };
  },

and then in mounted hook:

  mounted () {
    axios
      .get('https://restcountries.eu/rest/v2/region/europe')
      .then(response => {
        for (let i = 1; i <= 10; i++) {
          this.axiosOptions.push({text: response.data[i].name, value: response.data[i].alpha3Code});
        }
      });
  }

For more details please visit the following page: https://vuejs.org/v2/cookbook/using-axios-to-consume-apis.html

Best regards


Mikołaj Smoleński staff commented 5 years ago

I've also added the example code to our documentation pages: https://mdbootstrap.com/docs/vue/forms/select/#api



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: Free
  • Premium support: No
  • Technology: MDB Vue
  • MDB Version: 5.3.0
  • Device: pc
  • Browser: chrome
  • OS: windows 10
  • Provided sample code: No
  • Provided link: No