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-10-stylin.../app.js

36 lines
845 B
JavaScript
Raw Permalink Normal View History

2021-01-18 22:28:23 +01:00
"use strict";
2021-01-18 22:36:41 +01:00
const app = Vue.createApp({
data() {
return {
boxASelected: false,
boxBSelected: false,
boxCSelected: false,
};
},
computed: {
classesBoxA() {
return { active: this.boxASelected };
},
classesBoxB() {
return { active: this.boxBSelected };
},
classesBoxC() {
return { active: this.boxCSelected };
},
},
2021-01-18 22:36:41 +01:00
methods: {
boxSelected(box) {
if (box === "A") {
2021-01-18 22:45:24 +01:00
this.boxASelected = !this.boxASelected;
2021-01-18 22:36:41 +01:00
} else if (box === "B") {
2021-01-18 22:45:24 +01:00
this.boxBSelected = !this.boxBSelected;
2021-01-18 22:36:41 +01:00
} else if (box === "C") {
2021-01-18 22:45:24 +01:00
this.boxCSelected = !this.boxCSelected;
2021-01-18 22:36:41 +01:00
}
},
},
});
app.mount("#styling");