Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
XieZhiXiong
jinfa-platform
Commits
ac2ef148
Commit
ac2ef148
authored
Dec 22, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加锚点项组件
parent
1899d0bc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletion
+28
-1
Item.tsx
src/components/AnchorPage/Item.tsx
+24
-0
index.tsx
src/components/AnchorPage/index.tsx
+4
-1
No files found.
src/components/AnchorPage/Item.tsx
0 → 100644
View file @
ac2ef148
/*
* @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
;
src/components/AnchorPage/index.tsx
View file @
ac2ef148
...
@@ -10,6 +10,7 @@ import { Anchor } from 'antd';
...
@@ -10,6 +10,7 @@ import { Anchor } from 'antd';
import
{
ArrowLeftOutlined
}
from
'@ant-design/icons'
;
import
{
ArrowLeftOutlined
}
from
'@ant-design/icons'
;
import
{
history
}
from
'umi'
;
import
{
history
}
from
'umi'
;
import
useClientRect
from
'@/hooks/useClientRect'
;
import
useClientRect
from
'@/hooks/useClientRect'
;
import
AnchorPageItem
from
'./Item'
;
import
styles
from
'./index.less'
;
import
styles
from
'./index.less'
;
export
interface
AnchorsItem
{
export
interface
AnchorsItem
{
...
@@ -48,7 +49,7 @@ interface IProps {
...
@@ -48,7 +49,7 @@ interface IProps {
children
?:
React
.
ReactNode
,
children
?:
React
.
ReactNode
,
}
}
const
AnchorPage
:
React
.
FC
<
IProps
>
=
(
props
:
IProps
)
=>
{
const
AnchorPage
=
(
props
:
IProps
)
=>
{
const
{
const
{
title
,
title
,
extra
,
extra
,
...
@@ -144,4 +145,6 @@ AnchorPage.defaultProps = {
...
@@ -144,4 +145,6 @@ AnchorPage.defaultProps = {
children
:
null
,
children
:
null
,
};
};
AnchorPage
.
Item
=
AnchorPageItem
;
export
default
AnchorPage
;
export
default
AnchorPage
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment