用css3的empty属性,判断某个容器是否为空,如果是空的就把内容改为‘-’(或者其他值,读者可自定义)
1 2 3 4 5 6 7 8 9 10 11 12 13 | .emptyText :empty:not( i, tbody, .el-checkbox__inner, .el-table__fixed-right-patch, .el-switch__core, .el-color-picker__icon, .el-color-picker__mask, .el-radio__inner )::before { content : '-' ; color : #606266 ; } |
1 2 3 4 5 | < el-table class="emptyText" :data="tableData"> < el-table-column label="更新时间" prop="updateTime "/> < el-table-column label="描述" prop="desc"/> …… </ el-table > |