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-03-events.../app.js

29 lines
664 B
JavaScript
Raw Normal View History

2021-01-18 17:17:34 +01:00
const app = Vue.createApp({
2021-01-18 17:40:53 +01:00
data() {
return {
counter: 0,
2021-01-18 18:06:18 +01:00
name: "",
2021-01-18 18:23:34 +01:00
confirmedName: "",
2021-01-18 17:40:53 +01:00
};
},
2021-01-18 17:52:39 +01:00
methods: {
2021-01-18 18:23:34 +01:00
confirmName() {
this.confirmedName = this.name;
},
submitForm() {
alert("Submitted");
},
2021-01-18 18:09:41 +01:00
setName(event, lastName) {
this.name = event.target.value + " " + lastName;
2021-01-18 18:06:18 +01:00
},
2021-01-18 17:58:29 +01:00
increaseCounter(inputNumber) {
this.counter = this.counter + inputNumber;
2021-01-18 17:52:39 +01:00
},
2021-01-18 17:58:29 +01:00
decreaseCounter(inputNumber) {
this.counter = this.counter - inputNumber;
2021-01-18 17:52:39 +01:00
},
},
2021-01-18 17:17:34 +01:00
});
2021-01-18 17:40:53 +01:00
app.mount("#events");