Skip to content

Commit 11e2bc8

Browse files
committed
add popover doc
1 parent 8d7d6b9 commit 11e2bc8

File tree

9 files changed

+173
-155
lines changed

9 files changed

+173
-155
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<cn>
2+
#### 箭头指向
3+
设置了 `arrowPointAtCenter` 后,箭头将指向目标元素的中心。
4+
</cn>
5+
6+
<us>
7+
#### Arrow pointing
8+
The arrow points to the center of the target element, which set `arrowPointAtCenter`.
9+
</us>
10+
11+
```html
12+
<template>
13+
<div>
14+
<a-popover placement="topLeft">
15+
<template slot="content">
16+
<p>Content</p>
17+
<p>Content</p>
18+
</template>
19+
<span slot="title">Title</span>
20+
<a-button>Align edge / 边缘对齐</a-button>
21+
</a-popover>
22+
<a-popover placement="topLeft" arrowPointAtCenter>
23+
<template slot="content">
24+
<p>Content</p>
25+
<p>Content</p>
26+
</template>
27+
<span slot="title">Title</span>
28+
<a-button>Arrow points to center / 箭头指向中心</a-button>
29+
</a-popover>
30+
</div>
31+
</template>
32+
```

components/popover/demo/arrow-point-at-center.vue

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
1-
<template>
2-
<div>
3-
<md>
4-
## 基本
1+
<cn>
2+
#### 基本
53
最简单的用法,浮层的大小由内容区域决定。
6-
</md>
7-
<Popover title="Title">
4+
</cn>
5+
6+
<us>
7+
#### Basic
8+
The most basic example. The size of the floating layer depends on the contents region.
9+
</us>
10+
11+
```html
12+
<template>
13+
<a-popover title="Title">
814
<template slot="content">
915
<p>Content</p>
1016
<p>Content</p>
1117
</template>
1218
<a-button type="primary">Hover me</a-button>
13-
</Popover>
14-
</div>
19+
</a-popover>
1520
</template>
16-
17-
<script>
18-
import { Popover, Button } from 'antd'
19-
export default {
20-
components: {
21-
Popover,
22-
23-
},
24-
}
25-
</script>
21+
```
Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1+
<cn>
2+
#### 从浮层内关闭
3+
使用 `visible` 属性控制浮层显示。
4+
</cn>
5+
6+
<us>
7+
#### Controlling the close of the dialog
8+
Use `visible` prop to control the display of the card.
9+
</us>
10+
11+
```html
112
<template>
2-
<div>
3-
<md>
4-
## 从浮层内关闭
5-
使用 `visible` 属性控制浮层显示。
6-
</md>
7-
<Popover
13+
<a-popover
814
title="Title"
915
trigger="click"
1016
v-model="visible"
1117
>
1218
<a @click="hide" slot="content">Close</a>
1319
<a-button type="primary">Click me</a-button>
14-
</Popover>
15-
</div>
20+
</a-popover>
1621
</template>
1722

1823
<script>
19-
import { Popover, Button } from 'antd'
2024
export default {
2125
data () {
2226
return {
@@ -29,9 +33,6 @@ export default {
2933
this.visible = false
3034
},
3135
},
32-
components: {
33-
Popover,
34-
35-
},
3636
}
3737
</script>
38+
```

components/popover/demo/index.vue

Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,57 @@
1-
<template>
2-
<div>
3-
<h1>Basic</h1>
4-
<Basic />
5-
<h1>ArrowCenter</h1>
6-
<ArrowCenter />
7-
<h1>Control</h1>
8-
<Control />
9-
<h1>Placement</h1>
10-
<Placement />
11-
<h1>TriggerType</h1>
12-
<TriggerType />
13-
</div>
14-
</template>
151
<script>
162
import Basic from './basic'
173
import ArrowCenter from './arrow-point-at-center'
184
import Control from './control'
195
import Placement from './placement'
206
import TriggerType from './triggerType'
7+
import CN from '../index.zh-CN.md'
8+
import US from '../index.en-US.md'
9+
10+
const md = {
11+
cn: `# Popover
12+
13+
点击/鼠标移入元素,弹出气泡式的卡片浮层。
14+
15+
## 何时使用
16+
17+
当目标元素有进一步的描述和相关操作时,可以收纳到卡片中,根据用户的操作行为进行展现。
18+
19+
\`Tooltip\` 的区别是,用户可以对浮层上的元素进行操作,因此它可以承载更复杂的内容,比如链接或按钮等。
20+
## 代码演示`,
21+
us: `# Popover
22+
23+
The floating card popped by clicking or hovering.
24+
25+
## When To Use
26+
27+
A simple popup menu to provide extra information or operations.
28+
29+
Comparing with \`Tooltip\`, besides information \`Popover\` card can also provide action elements like links and buttons.
30+
## Examples
31+
`,
32+
}
2133
export default {
2234
category: 'Components',
2335
subtitle: '气泡卡片',
2436
type: 'Data Display',
2537
title: 'Popover',
26-
components: {
27-
Basic,
28-
ArrowCenter,
29-
Control,
30-
Placement,
31-
TriggerType,
38+
render () {
39+
return (
40+
<div>
41+
<md cn={md.cn} us={md.us}/>
42+
<Basic />
43+
<ArrowCenter />
44+
<Control />
45+
<Placement />
46+
<TriggerType />
47+
<api>
48+
<template slot='cn'>
49+
<CN/>
50+
</template>
51+
<US/>
52+
</api>
53+
</div>
54+
)
3255
},
3356
}
3457
</script>

0 commit comments

Comments
 (0)