Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const app = Vue.createApp({
- data() {
- return {
- result: 0,
- }
- },
- methods: {
- addOne() {
- this.result += 1;
- },
- addFive() {
- this.result += 5;
- }
- },
- computed: {
- shownResult() {
- const limit = 37;
- if (this.result < limit) {
- return 'Not there yet.'
- }
- if (this.result > limit) {
- return 'Too much!'
- }
- return this.result;
- }
- },
- watch: {
- shownResult() {
- setTimeout(() => {
- this.result = 0;
- }, 5000);
- }
- }
- });
- app.mount('#assignment');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement