Quasar: Is there any way to get the value typed into a QSelect with use-input before it gets removed on blur?

Viewed 3225

Per the docs you can add the attribute use-input to a QSelect component to introduce filtering and things of that nature: https://quasar.dev/vue-components/select#Native-attributes-with-use-input.

However, if you type something into one of these fields and click outside of it, the text gets removed.

Is there any way to grab that text in Vue before it gets removed and do something with it?

2 Answers

Since v1.9.9 there is also a @input-value event described in the q-select api.

As the api says it's emitted when the value in the text input changes. The new value is passed as parameter.

In the examples there's a filter function, so there you can save it in a data variable:

  methods: {
    filterFn (val, update, abort) {
      update(() => {
        this.myDataVariable = val;
      })
    }
  }
Related