Trigger in vue js and laravel

0

I'm doing a section to edit the selection of municipality and city I select them with this function:

  $("#departamento").val('{{$usuario->fk_id_departamento}}').trigger("change"); 

which works but when I change the function I use with Vue to load the municipalities corresponding to that department, it does not run, but if I do the manual change if it works, this is the function of vue:

new Vue({
    el: '#aplicacion',
    data: {
        departamento:'',
        municipios:[],
      },
      methods: {
        greet: function (event) {
            this.municipios = [];
            var id = event.target.value;
            var url = 'https://localhost/todojuegos/todojuegos/public/municipio/'+id;
            axios.get(url)
              .then(response => {
                this.municipios = response.data;
              })
              .catch(function (error) {
                console.log(error);
              });
        }
      },
});

In what way can I make the department's value when I make the change with the trigger, automatically execute the Vue greet method and load the municipalities.

    
asked by Andersson Meza Andrade 11.06.2018 в 17:19
source

0 answers