Search code examples
vue.jsionic-framework

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>


Solution

  • 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