[Vuejs]-How to use :value and v-model together

3👍

No need to bind the value to that prop just init age_keyup based on age :

<template>
  <div>
      <p>age</p>
      <input type="text"  v-model="age_keyup" @keyup="send()">
  </div>
</template>

<script>
export default {
  data: function () {
    return {
      age_keyup:null,
    }
  },
  methods: {
    send(){
       this.$emit("age_keyup", this.age_keyup);
    }
  },
  props: ['age'],
   mounted(){
     this.age_keyup=this.age
  }
}
</script>

Leave a comment