VUE JS set data from database

Posted 8 months ago by lucasmmduran

Hi, it's possible to set data from database to :md-options="options" in the data return options["data from database"] ?

Thank you so much, Lucas

Html: <md-autocomplete v-on:keyup="autoComplete" class="search" v-model="query" :md-options="results" md-layout="box"> Search... </md-autocomplete>

Script:

data: () => ({
  query: '',
  results: []
}),

methods: {
  autoComplete(){
      this.results = [];
      if(this.query.length > 2){
       axios.get('api/search',{params: {id: this.query}}).then(response => {
        this.results = response.data;
       });
      }
     }
}

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.