Elementui style modification in vue project

clipboard.png
in the vue project, to change the background color by clicking on the tag tag, the first idea is that the js click event directly changes the dom style. When you run, you find that the color has changed, and the method changes to the original color again after running. You don"t quite understand it, but ask for advice

.
Aug.21,2021

it is recommended to dynamically add class, to the parent of el-tag-info (your DOM node) and set the style you want in advance
for example, add a select-data when the parent is data-box,

.select-data{
    .el-tag-info{
        background-color:rgba(144, 147, 153, 0.1) !important
    }
}

vue binding: class= {select-data: flag}
when js modifies the style, flag = true

Menu