我是新的反应和使用and标签和分页,我试图链接标签与分页,以便活动标签应该有相同的活动号码在分页。请帮帮我。谢谢你
import React from 'react';
import { Tabs } from 'antd';
const App: React.FC = () => (
<Tabs defaultActiveKey="1">
<Tabs.TabPane tab="Tab 1" key="1">
Content of Tab Pane 1
</Tabs.TabPane>
<Tabs.TabPane tab="Tab 2" key="2">
Content of Tab Pane 2
</Tabs.TabPane>
<Tabs.TabPane tab="Tab 3" key="3">
Content of Tab Pane 3
</Tabs.TabPane>
</Tabs>
);
export default App; <Pagination
// current={current}
// onChange={onChange}
total={30}
/>`
我试图将选项卡的活动状态链接到分页的活动状态,但是找不到,我希望当我单击分页号时,当前的数字选项卡应该进入活动状态。
发布于 2022-11-28 07:44:48
给你:
import React, { useState } from 'react';
import './index.css';
import { Tabs, Pagination } from 'antd';
const App = () => {
const [current, setCurrent] = useState(1);
const onChange = (key: string) => {
setCurrent(key);
};
return (
<div>
<Tabs
activeKey={current}
defaultActiveKey={1}
onChange={onChange}
items={[
{
label: `Tab 1`,
key: 1,
children: `Content of Tab Pane 1`,
},
{
label: `Tab 2`,
key: 2,
children: `Content of Tab Pane 2`,
},
{
label: `Tab 3`,
key: 3,
children: `Content of Tab Pane 3`,
},
]}
/>
<Pagination
defaultCurrent={current}
total={3}
onChange={onChange}
pageSize={1}
/>
</div>
);
};
export default App;https://stackoverflow.com/questions/74597176
复制相似问题