From 8c672a568ad096f28d4c3a2ba95b01ecc30cc3ce Mon Sep 17 00:00:00 2001 From: Cristiano Magro <cristiano.magro@vola.it> Date: Thu, 26 Dec 2024 23:51:23 +0100 Subject: [PATCH] draw bar healt after attack --- 02 - basic/basics-05-using-the-native-event-object/app.js | 38 +++++++++++++++++++++++++++++++++----- 1 files changed, 33 insertions(+), 5 deletions(-) diff --git a/02 - basic/basics-05-using-the-native-event-object/app.js b/02 - basic/basics-05-using-the-native-event-object/app.js index 719c807..ce50ffe 100644 --- a/02 - basic/basics-05-using-the-native-event-object/app.js +++ b/02 - basic/basics-05-using-the-native-event-object/app.js @@ -2,12 +2,36 @@ data() { return { counter: 0, - name: '' + 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; + this.name = event.target.value; //+ ' ' + lastName; }, add(num) { this.counter = this.counter + num; @@ -15,8 +39,12 @@ reduce(num) { this.counter = this.counter - num; // this.counter--; - } - } + }, + resetInput() { + this.name = ""; + this.cogome = ""; + }, + }, }); -app.mount('#events'); +app.mount("#events"); -- Gitblit v1.8.0