2016-03-31 09:40:55 +08:00
|
|
|
---
|
|
|
|
order: 0
|
2016-08-26 14:42:41 +08:00
|
|
|
title:
|
|
|
|
zh-CN: 基本
|
|
|
|
en-US: Basic
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2015-06-17 16:58:13 +08:00
|
|
|
|
2016-08-26 14:42:41 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2016-03-24 11:25:23 +08:00
|
|
|
最简单的用法,浮层的大小由内容区域决定。
|
2015-06-17 16:58:13 +08:00
|
|
|
|
2016-08-26 14:42:41 +08:00
|
|
|
## en-US
|
|
|
|
|
|
|
|
The most basic example. The size of the floating layer depends on the contents region.
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
|
|
|
import React from 'react';
|
2015-10-28 20:55:49 +08:00
|
|
|
import { Popover, Button } from 'antd';
|
2015-10-08 15:13:04 +08:00
|
|
|
|
2016-01-07 16:29:12 +08:00
|
|
|
const content = (
|
|
|
|
<div>
|
2016-09-29 13:43:55 +08:00
|
|
|
<p>Content</p>
|
|
|
|
<p>Content</p>
|
2016-01-07 16:29:12 +08:00
|
|
|
</div>
|
|
|
|
);
|
2015-06-17 16:58:13 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => (
|
2016-09-29 13:43:55 +08:00
|
|
|
<Popover content={content} title="Title">
|
|
|
|
<Button type="primary">Hover me</Button>
|
2022-04-03 23:27:45 +08:00
|
|
|
</Popover>
|
2018-11-28 15:00:03 +08:00
|
|
|
);
|
2022-05-19 09:46:26 +08:00
|
|
|
|
|
|
|
export default App;
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|
2017-09-27 22:32:49 +08:00
|
|
|
|
|
|
|
<style>
|
2020-03-29 10:39:46 +08:00
|
|
|
.ant-popover-content p {
|
2017-09-27 22:32:49 +08:00
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
</style>
|