jeudi 25 avril 2019

How to pass v-model into another v-model

this is my input, i want to put the value to password equals with ic_number without retyping again in password input. can we pass the ic_number to password v-model?

          <div class="form-group">
                <label>Ic Number</label>
                <input
                  id="ic_number"
                  placeholder="Ic Number"
                  v-model="form.ic_number"
                  type="text"
                  name="ic_number"
                  class="form-control"
                  :class="{ 'is-invalid': form.errors.has('ic_number') }"
                >
                <has-error :form="form" field="ic_number"></has-error>
              </div>
            <div class="form-group">
                <label>Password</label>
                <input
                  id="password"
                  placeholder="Password"
                  v-model="form.password"
                  type="password"
                  name="password"
                  class="form-control"
                  :class="{ 'is-invalid': form.errors.has('passsword') }"
                >
                <has-error :form="form" field="password"></has-error>
              </div>

current code in my vuejs application

export default {
  data() {
    return {
      editMode: false,
      users: {},
      form: new Form({
        id: "",
        name: "",
        ic_number:"",
        no_phone:"",
        email: "",
        password: "",
        type: "",
        bio: "",
        photo: ""
      })
    };
  },

I want to pass like this but it shows nothing

        password: password = this.ic_number,




via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire