From c7ad6bfe145f9e2b61429c7f028ede018121c248 Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Mon, 18 Jan 2021 21:14:00 +0100 Subject: [PATCH] lesson 28: computed properties --- basics-05-using-the-native-event-object/app.js | 6 ++++-- basics-05-using-the-native-event-object/index.html | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/basics-05-using-the-native-event-object/app.js b/basics-05-using-the-native-event-object/app.js index 503a2c1..e47cc51 100644 --- a/basics-05-using-the-native-event-object/app.js +++ b/basics-05-using-the-native-event-object/app.js @@ -5,13 +5,15 @@ const app = Vue.createApp({ name: "", }; }, - methods: { - outputFullName() { + computed: { + fullName() { if (this.name === "") { return ""; } return this.name + " " + "Muster"; }, + }, + methods: { setName(event) { this.name = event.target.value; }, diff --git a/basics-05-using-the-native-event-object/index.html b/basics-05-using-the-native-event-object/index.html index b75664c..625f97d 100644 --- a/basics-05-using-the-native-event-object/index.html +++ b/basics-05-using-the-native-event-object/index.html @@ -22,7 +22,7 @@

Result: {{ counter }}

-

Your Name: {{ outputFullName() }}

+

Your Name: {{ fullName }}