commit | author | age
|
38b8f3
|
1 |
const app = Vue.createApp({ |
CM |
2 |
data() { |
|
3 |
return { |
|
4 |
counter: 0, |
778328
|
5 |
name: "", |
CM |
6 |
cognome: "", |
|
7 |
nometot: "", |
38b8f3
|
8 |
}; |
CM |
9 |
}, |
778328
|
10 |
watch: { |
CM |
11 |
// name(value){ |
|
12 |
// if (this.name === ''){ |
|
13 |
// this.nometot = ''; |
|
14 |
// } |
|
15 |
// this.nometot = value + " Cognome"; |
|
16 |
// } |
|
17 |
}, |
|
18 |
computed: { |
|
19 |
fullname() { |
|
20 |
if (this.name === "" || this.cognome === "") { |
|
21 |
return ""; |
|
22 |
} |
|
23 |
return this.name + " " + this.cognome; |
|
24 |
}, |
|
25 |
}, |
38b8f3
|
26 |
methods: { |
778328
|
27 |
// outputFullname() { |
CM |
28 |
// if (this.name === "" || this.cognome === "") { |
|
29 |
// return ""; |
|
30 |
// } |
|
31 |
// return this.name + " " + this.cognome; |
|
32 |
// }, |
38b8f3
|
33 |
setName(event, lastName) { |
778328
|
34 |
this.name = event.target.value; //+ ' ' + lastName; |
38b8f3
|
35 |
}, |
CM |
36 |
add(num) { |
|
37 |
this.counter = this.counter + num; |
|
38 |
}, |
|
39 |
reduce(num) { |
|
40 |
this.counter = this.counter - num; |
|
41 |
// this.counter--; |
778328
|
42 |
}, |
CM |
43 |
resetInput() { |
|
44 |
this.name = ""; |
|
45 |
this.cogome = ""; |
|
46 |
}, |
|
47 |
}, |
38b8f3
|
48 |
}); |
CM |
49 |
|
778328
|
50 |
app.mount("#events"); |