Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ionic input v-model is not working in my code

it's my first time trying Ionic + Vue App and in ionic-input the v-model is not working ... any help please?

    data() {
      return {

        model: {
          email: '',
          password: '',
        
        }
   <ion-input alternative
                              class="mb-3"
                              name="password"
                              :rules="{required: true, min: 6}"
                              prepend-icon="ni ni-lock-circle-open"
                              type="password"
                              v-model="model.password">
                  </ion-input>
like image 209
Aliessa Avatar asked Mar 26 '26 09:03

Aliessa


2 Answers

In my case, I was missing the IonInput import:

import {
  IonInput,
} from '@ionic/vue';
like image 151
Pablo Guerrero Avatar answered Mar 29 '26 03:03

Pablo Guerrero


We have the same issue. I've fixed it with :value and @ionInput.

<ion-input alternative
                          class="mb-3"
                          name="password"
                          :rules="{required: true, min: 6}"
                          prepend-icon="ni ni-lock-circle-open"
                          type="password"
                          :value="model.password"
                          @ionInput="model.password = $event.target.value;">
              </ion-input>

Found it here: https://github.com/ionic-team/ionic-framework/issues/15532#issuecomment-420031134

like image 21
AlexReiner Avatar answered Mar 29 '26 05:03

AlexReiner