From 0ba28e968e919440d7f28613aafe5ce8ea178798 Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Mon, 18 Jan 2021 17:52:39 +0100 Subject: [PATCH] move the logic out of the HTML code --- basics-03-events-starting-code/app.js | 8 ++++++++ basics-03-events-starting-code/index.html | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/basics-03-events-starting-code/app.js b/basics-03-events-starting-code/app.js index 0143165..5a87e3b 100644 --- a/basics-03-events-starting-code/app.js +++ b/basics-03-events-starting-code/app.js @@ -4,6 +4,14 @@ const app = Vue.createApp({ counter: 0, }; }, + methods: { + increaseCounter() { + this.counter++; + }, + decreaseCounter() { + this.counter--; + }, + }, }); app.mount("#events"); diff --git a/basics-03-events-starting-code/index.html b/basics-03-events-starting-code/index.html index e9cf80d..0e73c33 100644 --- a/basics-03-events-starting-code/index.html +++ b/basics-03-events-starting-code/index.html @@ -17,8 +17,8 @@

Events in Action

- - + +

Result: {{ counter }}