| | |
| | | <template> |
| | | <form @submit.prevent="submitData"> |
| | | <div> |
| | | <label>Utente: </label> |
| | | <input type="text" v-model="username"> |
| | | </div> |
| | | <div> |
| | | <label>Eta: </label> |
| | | <input type="text" v-model="age"> |
| | | </div> |
| | | <div> |
| | | <button>Update</button> |
| | | </div> |
| | | </form> |
| | | <div> |
| | | <label>Utente: </label> |
| | | <input type="text" v-model="username"> |
| | | </div> |
| | | <div> |
| | | <label>Eta: </label> |
| | | <input type="text" v-model="age"> |
| | | </div> |
| | | <div> |
| | | <button>Update</button> |
| | | </div> |
| | | </form> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | data(){ |
| | | data() { |
| | | return { |
| | | username: "", |
| | | age: "", |
| | | } |
| | | }, |
| | | emits: ['update-user'], |
| | | methods:{ |
| | | methods: { |
| | | submitData() { |
| | | |
| | | if(this.username !== "" && this.age !== ""){ |
| | | |
| | | this.$emit('update-user', this.username, this.age); |
| | | if (this.username !== "" && this.age !== "") { |
| | | this.$emit('update-user', this.username, this.age); |
| | | } else { |
| | | alert("insert data") |
| | | } |
| | | alert("insert data"); |
| | | } |
| | | |
| | | } |
| | | } |