vue-bootstrap-typeahead icon indicating copy to clipboard operation
vue-bootstrap-typeahead copied to clipboard

v-model does not show the value of the attribute loaded in created() or mounted()

Open LucasS03 opened this issue 5 years ago • 2 comments

Value of attribute q not load if alter in created() or mounted(), as in my example:

HTML:

<vue-bootstrap-typeahead
   v-model="q"
   :data="list"
   :serializer="i => i.name"
   placeholder="Choose your bank"
   @hit="selectedItem($event)"
   class="vue-autocomplete">
</vue-bootstrap-typeahead>

JAVASCRIPT:

data() {
   return {
      q: "",
      list: []
   }
},
mounted() {
   this.q = loadValueDatabase();
}

The value of attribute q is altered, but not renderized in v-model

LucasS03 avatar Apr 10 '20 18:04 LucasS03

I doubt similar issue has been opened, check there if any update.

ttodua avatar Apr 13 '20 08:04 ttodua

You can use ref to add loaded value.

<vue-bootstrap-typeahead ref="typeahead" v-model="q" :data="list" :serializer="i => i.name" placeholder="Choose your bank" @hit="selectedItem($event)" class="vue-autocomplete">

mounted() { this.$refs.typeahead.inputValue = loadValueDatabase(); }

mark-stephen-maduro avatar May 03 '20 20:05 mark-stephen-maduro