Commit ac2ef148 authored by XieZhiXiong's avatar XieZhiXiong

feat: 添加锚点项组件

parent 1899d0bc
/*
* @Description: 页面公用锚点项容器
*/
import React from 'react';
interface AnchorPageItemProps {
/**
* key,实际就是 标签id
*/
itemKey: string,
children?: React.ReactNode,
}
const AnchorPageItem: React.FC<AnchorPageItemProps> = (props: AnchorPageItemProps) => {
const { itemKey, children } = props;
return (
<div id={itemKey}>
{children}
</div>
);
};
export default AnchorPageItem;
......@@ -10,6 +10,7 @@ import { Anchor } from 'antd';
import { ArrowLeftOutlined } from '@ant-design/icons';
import { history } from 'umi';
import useClientRect from '@/hooks/useClientRect';
import AnchorPageItem from './Item';
import styles from './index.less';
export interface AnchorsItem {
......@@ -48,7 +49,7 @@ interface IProps {
children?: React.ReactNode,
}
const AnchorPage: React.FC<IProps> = (props: IProps) => {
const AnchorPage = (props: IProps) => {
const {
title,
extra,
......@@ -144,4 +145,6 @@ AnchorPage.defaultProps = {
children: null,
};
AnchorPage.Item = AnchorPageItem;
export default AnchorPage;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment