The element table removes the border border and has a vertical border at the same time

Why remove the boder border, the reason is that the border of the boder is the same as the background color of the page, and then the table appears to be recessed by one pixel

The requirement to be realized is to remove the border border from the table and add a vertical border at the same time.
Table concave
But if the boder attribute is not added, the table will have no vertical border
table with border
. This kind of bottom has no concave, but it seems irregular.
No concave
The final effect you want to achieve is
Cancel the borders on the left and right sides

first thought

The first idea is to find the boder of the table, and then modify the color of the boder through style penetration. There are two obstacles to this idea. The first is that if the border is set to white, the horizontal line of the table will not extend to the border Shen , the second is that only the border pseudo-classes on the left side of the table can be found, but the pseudo-classes on the right side cannot be found

left border pseudo class
pseudo class
I thought it was there at first .el-table__border-right-patch, but it wasn't

Therefore, only the left side can be modified through style penetration, and display:nonethe left border can be hidden

second way of thinking

The second way of thinking is to use the callback method of the table to add the right border to the table header and the grid cells of the form, and at the same time cancel the right border in the last column.
Of course, you can also add
the left border, but the first column cancels the left border . Header callback:
header callback
Form callback:
form callback
Add callback method
Add callback method
Callback function code:

const headerCellStyle = ({
     
     columnIndex}) => {
    
    
//这里的2是代表最后一列
		if (columnIndex !== 2) {
    
    
			return {
    
    
				borderRight: "1px #eee solid",
			}
		}
	}
const cellStyle = ({
     
     columnIndex}) => {
    
    
		if (columnIndex !== 2) {
    
    
			return {
    
    
				borderRight: "1px #eee solid"
			}
		}
	}

Achievement effect: there are no borders on the left and right sides, it will not appear concave, and there are vertical lines inside
No concave

Guess you like

Origin blog.csdn.net/weixin_44001222/article/details/128354872