React+antd 在限制高度内实现滚动显示多个组件(show scrolled components in a limited height with react antd)

效果:

代码:

import React from 'react';
import { Table } from 'antd';
import DatePicker1 from './DatePicker';

const pieArrs = [
{place_id: 3},
{place_id: 3},
{place_id: 3},
{place_id: 3},
{place_id: 3},
{place_id: 3},
{place_id: 3},
{place_id: 3},
{place_id: 3}]

const columns = [
{
title: 'Address',
dataIndex: 'address',
}];
const data = [];

{pieArrs.map((pieArr,index)=>
data.push({
key: index,
address: <DatePicker1 />,
})
)}

class ScrollTable extends React.Component {
render() {
return (
<div>
<Table columns={columns} dataSource={data} pagination={{ pageSize: 50 }} scroll={{ y: 240 }} />,
</div>
)
}
}

export default ScrollTable
 

猜你喜欢

转载自www.cnblogs.com/begin256/p/10539255.html