[Vuejs]-How to append input values to a list in Ionic App (VueJS)?

0👍

From what I can understand, your problem is caused by this @input="input.location.push($event.target.value)". It looks like that @input is acting like a onchange for ionic framework. If that’s the case, this is why everytime your input changes it push the content of your input letter by letter.

I would recommend to try using a v-model to track on the content of the input and on submit push the value into the array.

0👍

Your problem comes here:
@input=”input.barcode.push($event.target.value)”
Every time you press a key push value to input.barcode, so you need to use v-model (want to add finally value to your array position [0]

Here you have codesandbox working => https://codesandbox.io/s/vue-ionic-side-menus-9hp74

You cant use v-model on ion-input as tell here, but can use ionInput (@input):
https://github.com/ionic-team/ionic/issues/15532

0👍

you should be using ion-input-vue

  <ion-item>
    <ion-label position="stacked" color="primary">Email</ion-label>
    <ion-input-vue
      autocomple="off"
      v-model="inputData.email"
      name="username"
      type="email"
      spellcheck="false"
      autocapitalize="off"
    ></ion-input-vue>
  </ion-item>

Leave a comment