I have Vue.js application and there is a component with the code as following:
1) In "template" section:
<panel
:collapsible="true"
title="Basic section"
:iscollapsed="false"
class="category-panel"
:class="className"
>
2) In "data" section:
className: '',
3) In "methods" section:
toggleColor () {
if (!this.document.docDate) {
this.className = 'panel >>> .panel-title-red'
}
},
async save () {
this.toggleColor()
...
}
4) In "style" section:
.panel >>> .panel-title
font-weight 400
.panel >>> .panel-title-red
font-weight 400
color red
The panel's title uses first class in "style" section, which means the color of panel's title is black. When I click "save" button I call toggleColor method and under some condition I want to change the color to red. It doesn't work in this way. How to make it work?