1. 程式人生 > 實用技巧 >elementUi給特殊的屬性值設定樣式

elementUi給特殊的屬性值設定樣式

可以通過scope.row.屬性名和三目運算子給特殊的屬性值設定樣式

類似下面的效果

            <el-table-column
                        property="examine"
                        label="稽核情況"
                        width="">
                        <template slot-scope="scope">
                            <div :class="scope.row.examine === '待稽核' ? 'specailColor' : ''"
>{{scope.row.examine}}</div> </template> </el-table-column> <el-table-column property="publish" label="公示情況" width=""> <
template slot-scope="scope"> <div :class="scope.row.publish === '未公示' ? 'specailColor' : ''">{{scope.row.publish}}</div> </template> </el-table-column>

https://www.jianshu.com/p/2251cda42425