diff --git a/basics-assignment-3-problem/app.js b/basics-assignment-3-problem/app.js index e69de29..f6a15cb 100644 --- a/basics-assignment-3-problem/app.js +++ b/basics-assignment-3-problem/app.js @@ -0,0 +1,34 @@ +"use strict"; + +const app = Vue.createApp({ + data() { + return { + result: 0, + }; + }, + watch: { + result() { + const that = this; + setTimeout(function () { + that.result = 0; + }, 5000); + }, + }, + computed: { + status() { + if (this.result < 37) { + return "Not there yet"; + } + if (this.result > 37) { + return "Too much!"; + } + }, + }, + methods: { + increaseCounter(value) { + this.result += value; + }, + }, +}); + +app.mount("#assignment"); diff --git a/basics-assignment-3-problem/index.html b/basics-assignment-3-problem/index.html index b2ec103..545f129 100644 --- a/basics-assignment-3-problem/index.html +++ b/basics-assignment-3-problem/index.html @@ -16,12 +16,13 @@

Reactivity in Action

- - + + -

Result: RESULT

+

{{ status }}

+

Result: {{ result }}