This repository has been archived on 2021-09-06. You can view files and clone it, but cannot push or open issues or pull requests.
2021-01-18 20:47:58 +01:00
|
|
|
const app = Vue.createApp({
|
2021-01-18 20:56:35 +01:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
counter: 0,
|
|
|
|
name: "",
|
2021-01-18 21:28:07 +01:00
|
|
|
lastName: "",
|
2021-01-18 21:33:06 +01:00
|
|
|
// fullName: "",
|
2021-01-18 20:56:35 +01:00
|
|
|
};
|
2021-01-18 20:47:58 +01:00
|
|
|
},
|
2021-01-18 21:33:06 +01:00
|
|
|
// watch: {
|
|
|
|
// name(value) {
|
|
|
|
// if (value === "") {
|
|
|
|
// this.fullName = "";
|
|
|
|
// } else {
|
|
|
|
// this.fullName = value + " " + this.lastName;
|
|
|
|
// }
|
|
|
|
// },
|
|
|
|
// lastName(value) {
|
|
|
|
// if (value === "") {
|
|
|
|
// this.fullName = "";
|
|
|
|
// } else {
|
|
|
|
// this.fullName = this.name + " " + value;
|
|
|
|
// }
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
computed: {
|
|
|
|
fullName() {
|
|
|
|
if (this.name === "" || this.lastName === "") {
|
|
|
|
return "";
|
2021-01-18 21:02:10 +01:00
|
|
|
}
|
2021-01-18 21:33:06 +01:00
|
|
|
return this.name + " " + this.lastName;
|
2021-01-18 21:02:10 +01:00
|
|
|
},
|
2021-01-18 21:14:00 +01:00
|
|
|
},
|
|
|
|
methods: {
|
2021-01-18 21:00:01 +01:00
|
|
|
setName(event) {
|
2021-01-18 20:56:35 +01:00
|
|
|
this.name = event.target.value;
|
|
|
|
},
|
|
|
|
add(num) {
|
|
|
|
this.counter = this.counter + num;
|
|
|
|
},
|
|
|
|
reduce(num) {
|
|
|
|
this.counter = this.counter - num;
|
|
|
|
// this.counter--;
|
|
|
|
},
|
|
|
|
resetInput() {
|
|
|
|
this.name = "";
|
2021-01-18 21:33:06 +01:00
|
|
|
this.lastName = "";
|
2021-01-18 20:56:35 +01:00
|
|
|
},
|
2021-01-18 20:47:58 +01:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2021-01-18 20:56:35 +01:00
|
|
|
app.mount("#events");
|