-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(Popup): update popperOptions usage (#3200)
* docs(popup): update popperOptions usage * ci(popup): update test snap * docs(popup): update docs
- Loading branch information
1 parent
1dcb3df
commit d125788
Showing
5 changed files
with
193 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React, { useState } from 'react'; | ||
import { Button, Input, Popup, Space } from 'tdesign-react'; | ||
|
||
export default function PopperOptions() { | ||
const [offsetX, setOffsetX] = useState('0'); | ||
const [offsetY, setOffsetY] = useState('0'); | ||
|
||
return ( | ||
<Space direction="vertical"> | ||
<Space> | ||
<Space align="center"> | ||
<span>请输入横向偏移量:</span> | ||
<Input | ||
placeholder="请输入横向偏移量" | ||
value={offsetX} | ||
onChange={(v) => setOffsetX(v)} | ||
style={{ width: '130px', display: 'inline-block' }} | ||
/> | ||
</Space> | ||
<Space align="center"> | ||
<span>请输入纵向偏移量:</span> | ||
<Input | ||
placeholder="请输入纵向偏移量" | ||
value={offsetY} | ||
onChange={(v) => setOffsetY(v)} | ||
style={{ width: '130px', display: 'inline-block' }} | ||
/> | ||
</Space> | ||
</Space> | ||
<Space> | ||
<Popup | ||
trigger="hover" | ||
showArrow | ||
content="这是一个弹出框" | ||
popperOptions={{ | ||
modifiers: [ | ||
{ | ||
name: 'offset', | ||
options: { | ||
offset: [Number(offsetX), Number(offsetY)], | ||
}, | ||
}, | ||
], | ||
}} | ||
> | ||
<Button>Hover me</Button> | ||
</Popup> | ||
</Space> | ||
</Space> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters