parent
68032285bb
commit
dca9db4482
@ -0,0 +1,14 @@
|
|||||||
|
import React, { PureComponent } from 'react';
|
||||||
|
import connect from 'react-redux';
|
||||||
|
|
||||||
|
class CommitTab extends PureComponent {
|
||||||
|
|
||||||
|
render () {
|
||||||
|
return (
|
||||||
|
<h2>提交页</h2>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// export default connect()(CommitTab);
|
||||||
|
export default CommitTab;
|
@ -0,0 +1,15 @@
|
|||||||
|
import React, { PureComponent } from 'react';
|
||||||
|
import connect from 'react-redux';
|
||||||
|
|
||||||
|
class EditTab extends PureComponent {
|
||||||
|
|
||||||
|
componentDidMount () {}
|
||||||
|
render () {
|
||||||
|
return (
|
||||||
|
<h2>编辑页</h2>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// export default connect()(EditTab);
|
||||||
|
export default EditTab;
|
@ -0,0 +1,40 @@
|
|||||||
|
import React, { useState } from 'react';
|
||||||
|
import { Tabs } from 'antd';
|
||||||
|
import EditorTab from './editorTab';
|
||||||
|
import PrevTab from './prevTab';
|
||||||
|
import CommitTab from './commitTab';
|
||||||
|
|
||||||
|
const { TabPane } = Tabs;
|
||||||
|
|
||||||
|
const LeftPane = () => {
|
||||||
|
|
||||||
|
const [defaultActiveKey, setDefaultActiveKey] = useState('2');
|
||||||
|
|
||||||
|
const tabArrs = [
|
||||||
|
{ title: '编辑', key: '1', content: EditorTab },
|
||||||
|
{ title: '预览', key: '2', content: PrevTab },
|
||||||
|
{ title: '提交记录', key: '3', content: CommitTab },
|
||||||
|
];
|
||||||
|
|
||||||
|
const tabs = tabArrs.map((tab) => {
|
||||||
|
const Comp = tab.content;
|
||||||
|
return (
|
||||||
|
<TabPane tab={tab.title} key={tab.key}>
|
||||||
|
<Comp />
|
||||||
|
</TabPane>
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
|
// tab切换时
|
||||||
|
const handleTabChange = (key) => {
|
||||||
|
setDefaultActiveKey(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Tabs activeKey={defaultActiveKey} onChange={handleTabChange}>
|
||||||
|
{ tabs }
|
||||||
|
</Tabs>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default LeftPane;
|
@ -0,0 +1,15 @@
|
|||||||
|
import React, { PureComponent } from 'react';
|
||||||
|
// import connect from 'react-redux';
|
||||||
|
|
||||||
|
class PrevTab extends PureComponent {
|
||||||
|
|
||||||
|
state = {}
|
||||||
|
render () {
|
||||||
|
return (
|
||||||
|
<h2>预览页</h2>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// export default connect()(PrevTab);
|
||||||
|
export default PrevTab;
|
Loading…
Reference in new issue