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