forked from ant-design/ant-design
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
83790df
commit 2ca3661
Showing
9 changed files
with
147 additions
and
64 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
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 was deleted.
Oops, something went wrong.
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,75 @@ | ||
--- | ||
order: 1 | ||
title: | ||
zh-CN: 自定义位置 | ||
en-US: Custom Placement | ||
--- | ||
|
||
## zh-CN | ||
|
||
自定义位置,点击触发按钮抽屉从相应的位置滑出,点击遮罩区关闭 | ||
|
||
## en-US | ||
|
||
Basic drawer. | ||
|
||
```jsx | ||
import { Drawer, Button, Radio } from 'antd'; | ||
|
||
const RadioGroup = Radio.Group; | ||
|
||
class App extends React.Component { | ||
state = { visible: false, placement: 'left' }; | ||
|
||
showDrawer = () => { | ||
this.setState({ | ||
visible: true, | ||
}); | ||
}; | ||
|
||
onClose = () => { | ||
this.setState({ | ||
visible: false, | ||
}); | ||
}; | ||
|
||
onChange = (e) => { | ||
this.setState({ | ||
placement: e.target.value, | ||
}); | ||
} | ||
|
||
render() { | ||
return ( | ||
<div> | ||
<RadioGroup | ||
style={{ marginRight: 8 }} | ||
defaultValue={this.state.placement} | ||
onChange={this.onChange} | ||
> | ||
<Radio value="top">top</Radio> | ||
<Radio value="right">right</Radio> | ||
<Radio value="bottom">bottom</Radio> | ||
<Radio value="left">left</Radio> | ||
</RadioGroup> | ||
<Button type="primary" onClick={this.showDrawer}> | ||
Open | ||
</Button> | ||
<Drawer | ||
title="Basic Drawer" | ||
placement={this.state.placement} | ||
closable={false} | ||
onClose={this.onClose} | ||
visible={this.state.visible} | ||
> | ||
<p>Some contents...</p> | ||
<p>Some contents...</p> | ||
<p>Some contents...</p> | ||
</Drawer> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
ReactDOM.render(<App />, mountNode); | ||
``` |
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