search

Home  >  Q&A  >  body text

javascript - How does vue trigger the change event by changing the value of the select through assignment?

Get the value of select from the background and assign it to select, how to trigger the change event
The abbreviation of the html code is as follows:

<select v-model="resData.type" @change="supRes(resData.type)" >
    <option value="">--请选择--</option>
    <option value="2">123</option>
    <option value="3">456</option>
</select>

js code abbreviation is as follows:

axios({
  method:"get",
  url:"***",
  params:{ id : row.id }
  }).then((res)=>{
  var data = res.data.content;
  this.resData = {
      type : data.type
  }
 })
supRes:function(val){
  console.log(val)
}
typechotypecho2717 days ago1394

reply all(2)I'll reply

  • 某草草

    某草草2017-07-05 10:40:50

    Is it possible to watch resData.type directly? Change in disguise

    reply
    0
  • 天蓬老师

    天蓬老师2017-07-05 10:40:50

    Trigger manually

    reply
    0
  • Cancelreply