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.
vuejs_course/basics-05-using-the-native-.../app.js

52 lines
1.1 KiB
JavaScript

const app = Vue.createApp({
data() {
return {
counter: 0,
name: "",
lastName: "",
fullName: "",
};
},
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 === "") {
// return "";
// }
// return this.name + " " + "Muster";
// },
},
methods: {
setName(event) {
this.name = event.target.value;
},
add(num) {
this.counter = this.counter + num;
},
reduce(num) {
this.counter = this.counter - num;
// this.counter--;
},
resetInput() {
this.name = "";
},
},
});
app.mount("#events");