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

"use strict";
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 };
},
},
methods: {
boxSelected(box) {
if (box === "A") {
this.boxASelected = !this.boxASelected;
} else if (box === "B") {
this.boxBSelected = !this.boxBSelected;
} else if (box === "C") {
this.boxCSelected = !this.boxCSelected;
}
},
},
});
app.mount("#styling");