[Vuejs]-Vue.js: vue-multiselect, clearing input value after selected

-3👍

If your v-model is just modeling the value selected, then you need to use that value however you want and reset value to null. I don’t really know how your component is set up but it would look something like this:

<template>
  <select v-model="value" v-on:change="doSomething()">
    <option :value="null">-- Select --</option>
    <option value="foo">Foo</option>
    <option value="bar">Bar</option>
  </select>
</template>

<script>
  module.exports = {
    data: function(){
      return {
        value: null
      };
    },
    methods: {
      doSomething: function() {
        if( this.value ) {
          var data = this.value; // now you can work with data
          this.value = null; // reset the select to null
        }
      }
    }
  }
</script>

Leave a comment