当前位置:网站首页>Elmentui table style customization (row color, background color, content scrolling, de scrolling bar)
Elmentui table style customization (row color, background color, content scrolling, de scrolling bar)
2022-04-22 07:53:00 【Whole stack Xiaoding】
List of articles
Preface
Custom table colors 、 Style method sorting
1. Custom title color
:header-cell-style="{ background:'#121626' , color:'#606266' }"
Actual demonstration
2. Row color customization
- Method 1 Direct definition
:row-style="{backgroundColor:'#121626'}"
Actual demonstration
- Method 2 Dynamic colors
// Component add
:row-class-name="tableRowClassName"
// Method area
tableRowClassName({
row, rowIndex}) {
if (rowIndex === 1) {
return 'redRow';
} else if (rowIndex === 3) {
return 'greenRow';
}
return '';
}
<style> .el-table .redRow {
background: red;
}
.el-table .greenRow {
background: green;
}
</style>
Actual demonstration
3. Background color when there is no data
style="background-color:#121626; border: 1px solid rgb(41, 48, 77);"

effect
4. The table scrolls automatically
add to ref Parameters
/** * Table scrolling */
rollTable () {
// Get the real after the form is mounted DOM
const table = this.$refs.table
// Get the data in the table div Elements
const divData = table.bodyWrapper
// When you get the element , Timing the element to increase the distance from the top , Achieve scrolling effect ( This configuration is per 100 Millisecond movement 1 Pixels )
setInterval(() => {
// The element increases from the top 1 Pixels
divData.scrollTop += 1
// Determine whether the element scrolls to the bottom ( Visual height + Distance from top = The whole height )
if (divData.clientHeight + divData.scrollTop === divData.scrollHeight) {
// Reset table Distance from the top
divData.scrollTop = 0
}
}, 500) // Rolling speed
},
Actual demonstration
5. Remove scroll bars from tables and pages
/* To scroll bar */
<style lang="scss" scoped>
/* To scroll bar */
::-webkit-scrollbar {
width: 0 !important;
/* Width of scroll bar */
height: 7px;
/* Scroll bar height */
background-color: rgb(0, 12, 46);
}
</style>
Effect demonstration
版权声明
本文为[Whole stack Xiaoding]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220622343282.html
边栏推荐
猜你喜欢
随机推荐
C-9结构体:计算输入日期是该年的第几天
Multithreading (threaded Communication [producer and consumer])
[C - attribute]
[TCP / IP overview]
VC call control
【TCP/IP 四 IP 网际协议】
Find points without obstacles on 3D map
Thread pool usage
QT[一] 信号与槽
Use of branches in C #
[communication interface can bus]
C# break,continue,return的区别和使用
MFC常用格式转换及函数
树莓派:4.2寸墨水屏
Unity update obtains the difference between the current frame and the previous frame
Rt-thread [三] link.lds链接脚本详解
Problem C: 汉诺塔Ⅲ
@ transactional transaction propagation in the same class
STM32 peripherals [3] serial port RS232 RS485
观察者模式--ApplicationContext








![Rt-thread [二] 系统初始化流程](/img/46/6e2942e4c18c0220378050205e6528.png)








