当前位置:网站首页>Antd table how scroll bars appear in long tables
Antd table how scroll bars appear in long tables
2022-06-21 08:03:00 【Have a good time I】

As shown in the figure above, you want to realize the following , see antd table Official documents want to achieve this , The presentation was not very detailed , To achieve a pile of holes .
The tables on Alibaba cloud pages , There is also a lot of stretching bug, I don't know how to implement it , Let me introduce a method to realize the following , Not afraid of stretching …
<div class="content">
<a-table :columns="columns" :data-source="dataSource" :row-key="record => record.id" :pagination="pagination" :scroll="{ x: '1400px' | true }" class="charge-table" @change="handleTableChange" >
<div slot="trialQuota" slot-scope="text">{
{ text }} Hours </div>
<template slot="action" slot-scope="text, record">
<a-button type="link" style="margin-left: -8px" @click="openDetail(text, record)"> details </a-button>
<a-button type="link" @click="openCharge(text)"> Charge account </a-button>
<a-button type="link" :disabled="text.tryData" @click="onTry(text)"> The trial </a-button>
</template>
</a-table>
</div>
.content {
flex: 1;
background: #ffffff;
border-radius: 8px;
padding: 0 20px;
position: relative;
}
/deep/.ant-spin-nested-loading {
position: absolute;
left: 20px;
right: 20px;
}
The point is css Set absolute positioning ,columns Each item should be set width, And width Must be fixed px, It can't be a percentage (%), Otherwise the stretch will be hidden , It doesn't matter whether the cells are broken into rows , At the beginning, I stepped on a lot of holes here
const columns = [
{
title: ' Number ',
dataIndex: 'id',
// width: '3.4%',
width: '58px'
},
{
title: ' User platform name ',
dataIndex: 'ourUserName',
// width: '6.9%',
width: '173px'
},
{
title: ' User external name ',
dataIndex: 'userName',
// scopedSlots: { customRender: 'userName' },
// width: '166px'
// width: '6.9%',
width: '145px',
ellipsis: true
},
{
title: ' User group ',
dataIndex: 'groupDesc',
// scopedSlots: { customRender: 'groupDesc' },
// width: '10%',
ellipsis: true,
width: '198px'
},
{
title: ' User group accounts ',
dataIndex: 'groupName',
// width: '8.4%',
width: '145px'
},
{
title: ' balance ( Company : Nuclear time )',
dataIndex: 'corestimeBalance',
// width: '7.9%',
width: '129px'
},
{
title: 'VPN Address ',
dataIndex: 'vpnAddress',
scopedSlots: {
customRender: 'vpnAddress' },
// width: '13.2%',
width: '217px'
// ellipsis: true,
// width: '246px'
// customCell: () => {
// return {
// style: {
// 'min-width': '300px',
// 'white-space': 'nowrap',
// 'text-overflow': 'ellipsis'
// }
// }
// }
// customCell: () => {
// return {
// style: {
// 'color':'yellow',
// 'width': '246px'
// }
// }
// },
// customHeaderCell: () => {
// return {
// style: {
// 'color':'yellow',
// 'width': '246px'
// }
// }
// }
},
{
title: 'SSH Address ',
dataIndex: 'sshAddress',
ellipsis: true,
// width: '13.2%',
width: '245px'
},
{
title: ' Trial mode ',
dataIndex: 'trialMethod',
ellipsis: true,
// width: '7.8%',
width: '128px'
},
{
title: ' Trial quota ',
dataIndex: 'trialQuota',
// width: '6.9%',
width: '104px',
scopedSlots: {
customRender: 'trialQuota' }
},
{
title: ' Cluster operation ',
key: 'action',
scopedSlots: {
customRender: 'action' },
fixed: 'right',
width: '132px'
}
]
The results are as follows :
边栏推荐
- Illustration of Google V8 16: how does V8 improve function execution efficiency through inline caching?
- Scientific research information | national natural conclusion regulations: more than 50% of the fund balance or it will not be concluded
- 1005 spell it right (20 points) (test point 3)
- Illustration Google V8 15: Hidden classes: how to quickly find object attributes in memory?
- Leetcode topic [array] -40- combined sum II
- 虚拟机浏览器花屏空白问题
- Global and Chinese market for diamond blades 2022-2028: Research Report on technology, participants, trends, market size and share
- [visualization - source code reading] antvis / g-base interpretation - 1
- RPA (shadow knife) does not need to write code to capture the product information of an East
- What are the differences between SQL and MySQL
猜你喜欢

Figure neural network and cognitive reasoning - Tang Jie - Tsinghua University

RISC-V 的MMU

Dynamic programming to solve the problem of looting

Qunhui dsm7 add kit source

2021-06-18 STM32F103 DMA and DMA serial port code using firmware library

Illustration of Google V8 16: how does V8 improve function execution efficiency through inline caching?

2022-2028 global internal gear motor industry research and trend analysis report

MMS for risc-v

2021-07-28 STM32F103配置信息
![[kotlin] first day](/img/51/18b394a6bf0ab74b71e5c59ad3341c.png)
[kotlin] first day
随机推荐
[untitled]
Three declaration methods of structure type
Redis cache use case
Dynamic programming to solve the problem of looting
Haidilao is expected to have an annual net loss of 3.8 billion to 4.5 billion and close more than 300 stores
Global and Chinese market of carton folding and bonding machines 2022-2028: Research Report on technology, participants, trends, market size and share
PostgreSQL database firstborn - background first-class citizen process startupdatabase startupxlog function enters recovery mode
Blank screen of virtual machine browser
Cluster hui dsm7 add suite source
Yunkang group passed the hearing: the revenue exceeded 1billion in 8 months and the profit within the period was 270Million
运算符优先级与结合顺序
1005 Spell It Right (20 分)(测试点3)
2021-07-28 STM32F103配置信息
How to use lerna to manage multiple packages
Bean实例化的三种方法
[redis]-[redis underlying data structure]-sds
How can we make millions a year now?
Dans l'unité, la caméra de réalité déplace le miroir et regarde vers l'avant de l'objet sur la base de dotween
PHP类与对象详细介绍
Le Code est correct, mais les données de la base de données ne sont pas affichées.