6108d09c4c
since the :class parameter awaits true and false I can compute those directly inside the computed properties.
29 lines
646 B
JavaScript
29 lines
646 B
JavaScript
"use strict";
|
|
|
|
const app = Vue.createApp({
|
|
data() {
|
|
return {
|
|
inputClass: "",
|
|
paragraphVisible: true,
|
|
inputColor: "",
|
|
};
|
|
},
|
|
computed: {
|
|
classFromUserInput() {
|
|
return {
|
|
user1: this.inputClass === "user1",
|
|
user2: this.inputClass === "user2",
|
|
visible: this.paragraphVisible,
|
|
hidden: !this.paragraphVisible,
|
|
};
|
|
},
|
|
},
|
|
methods: {
|
|
toggleParagraphVisibility() {
|
|
this.paragraphVisible = !this.paragraphVisible;
|
|
},
|
|
},
|
|
});
|
|
|
|
app.mount("#assignment");
|