Vue-material: MdSelect @change

Created on 4 Jan 2018  路  5Comments  路  Source: vuematerial/vue-material

Hi,

Event change from MdSelect dont fire.

<md-field>
      <md-select name="deck" id="deck" @change="greet">                    
          <md-option value="1">1</md-option>
          <md-option value="2">2</md-option>
          <md-option value="3">3</md-option>
      </md-select>
  </md-field>

methods: {
    greet: function(event) {
      console.log('teste');
    }
  }

What I missing?

question

Most helpful comment

name="locationProvince"
id="locationProvince"
v-model="form.location.provinceId"
md-dense
:disabled="sending"
@md-selected="onProvinceSelect"
>

... // your option here

Just use @md-selected="functionName"

methods:{
functionName(v){
console.log(v);
}
}

All 5 comments

You could have a v-model on the select, you will need to specify greet as a variable in data.

Then watch for changes to the variable, changing the option will update set the option value to the greet variable.

eg

<md-field>
      <md-select name="deck" id="deck" v-model="greet">                    
          <md-option value="1">1</md-option>
          <md-option value="2">2</md-option>
          <md-option value="3">3</md-option>
      </md-select>
  </md-field>

watch: {
    greet: function(event) {
      console.log('teste');
    }
  }

There is an event md-selected triggered when model changes.

https://vuematerial.io/components/select

how to use md-selected? can you proved some samples please

name="locationProvince"
id="locationProvince"
v-model="form.location.provinceId"
md-dense
:disabled="sending"
@md-selected="onProvinceSelect"
>

... // your option here

Just use @md-selected="functionName"

methods:{
functionName(v){
console.log(v);
}
}

name="locationProvince"
id="locationProvince"
v-model="form.location.provinceId"
md-dense
:disabled="sending"
@md-selected="onProvinceSelect"
>

... // your option here
Just use @md-selected="functionName"

methods:{
functionName(v){
console.log(v);
}
}

Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lee-frank picture lee-frank  路  3Comments

bjarnik picture bjarnik  路  3Comments

bryanspearman picture bryanspearman  路  3Comments

korylprince picture korylprince  路  3Comments

xinzhanguo picture xinzhanguo  路  3Comments