Vue.js get selected option on @change

前端 未结 5 1753
被撕碎了的回忆
被撕碎了的回忆 2020-11-27 12:28

First, i want to say that im new to Vue, and this is my first project ever using Vue. I have combobox and I want to do something different based on the selected combobox. I

5条回答
  •  感情败类
    2020-11-27 13:09

    You can save your @change="onChange()" an use watchers. Vue computes and watches, it´s designed for that. In case you only need the value and not other complex Event atributes.

    Something like:

      ...
      watch: {
        leaveType () {
          this.whateverMethod(this.leaveType)
        }
      },
      methods: {
         onChange() {
             console.log('The new value is: ', this.leaveType)
         }
      }
    

提交回复
热议问题