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