add a real example for watchers

This commit is contained in:
Andreas Zweili 2021-01-18 21:34:43 +01:00
parent b64a3bd35e
commit bc69656d06
1 changed files with 10 additions and 16 deletions

View File

@ -7,22 +7,16 @@ const app = Vue.createApp({
// 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;
// }
// },
// },
watch: {
counter(value) {
if (value > 50) {
const that = this;
setTimeout(function () {
that.counter = 0;
}, 2000);
}
},
},
computed: {
fullName() {
if (this.name === "" || this.lastName === "") {