commit | author | age
|
bc995b
|
1 |
<template> |
ff5308
|
2 |
<form @submit.prevent="submitData"> |
05275d
|
3 |
<div> |
CM |
4 |
<label>Utente: </label> |
|
5 |
<input type="text" v-model="username"> |
|
6 |
</div> |
|
7 |
<div> |
|
8 |
<label>Eta: </label> |
|
9 |
<input type="text" v-model="age"> |
|
10 |
</div> |
|
11 |
<div> |
|
12 |
<button>Update</button> |
|
13 |
</div> |
|
14 |
</form> |
bc995b
|
15 |
</template> |
CM |
16 |
|
|
17 |
<script> |
|
18 |
export default { |
05275d
|
19 |
data() { |
ff5308
|
20 |
return { |
CM |
21 |
username: "", |
|
22 |
age: "", |
|
23 |
} |
|
24 |
}, |
|
25 |
emits: ['update-user'], |
05275d
|
26 |
methods: { |
ff5308
|
27 |
submitData() { |
bc995b
|
28 |
|
05275d
|
29 |
if (this.username !== "" && this.age !== "") { |
CM |
30 |
this.$emit('update-user', this.username, this.age); |
ff5308
|
31 |
} else { |
05275d
|
32 |
alert("insert data"); |
CM |
33 |
} |
ff5308
|
34 |
|
CM |
35 |
} |
|
36 |
} |
bc995b
|
37 |
} |
CM |
38 |
</script> |