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/2021-01-18 basics-assignmen.../app.js

36 lines
728 B
JavaScript
Raw Normal View History

2021-01-18 22:12:11 +01:00
"use strict";
const app = Vue.createApp({
data() {
return {
2021-01-18 22:26:19 +01:00
counter: 0,
2021-01-18 22:12:11 +01:00
};
},
watch: {
2021-01-18 22:26:19 +01:00
status() {
2021-01-18 22:12:11 +01:00
const that = this;
setTimeout(function () {
2021-01-18 22:26:19 +01:00
that.counter = 0;
2021-01-18 22:12:11 +01:00
}, 5000);
},
},
computed: {
status() {
2021-01-18 22:26:19 +01:00
if (this.counter < 37) {
2021-01-18 22:12:11 +01:00
return "Not there yet";
2021-01-18 22:26:19 +01:00
} else if (this.counter > 37) {
2021-01-18 22:12:11 +01:00
return "Too much!";
2021-01-18 22:26:19 +01:00
} else if (this.counter === 37) {
return this.counter;
2021-01-18 22:12:11 +01:00
}
},
},
methods: {
increaseCounter(value) {
2021-01-18 22:26:19 +01:00
this.counter += value;
2021-01-18 22:12:11 +01:00
},
},
});
app.mount("#assignment");