[Vuejs]-How do I use cell-class-name of el-table correctly?

3👍

Removing the scoped attribute from the style tag should fix it.

You can separate them in the following way:

<style>

.selected-cell {
    background: red;
    color: red;
}

</style>

<style scoped>

/* other styles here*/

</style>
👤Fab

0👍

I was experiencing a similar scenario where my class definitions were not recognised / applied on my designs.

As previously mentioned above, on my case Ive tried it with stylus and it worked very well too.

<style lang="stylus">
total-bg-color = rgba(242,242,242,0.3)
.total-row
    background-color total-bg-color !important
    td .cell
        font-weight bold
            
</style>
<style lang="stylus" scoped>
color-white = rgba(255,255,255,1)
    
.layerTable
    margin-top 0.5rem
    background-color color-white !important
    overflow-x auto
    padding-left 0.5rem
    padding-right 0.5rem
    .el-table
        margin-top 1rem
        
</style>

As you can notice, there is a block without the scoped tag (the first one), in that area it worked like a charm, but in the other block with the scoped tag, it did not.

Leave a comment