mirror of https://github.com/ElemeFE/element
72 lines
2.4 KiB
Markdown
72 lines
2.4 KiB
Markdown
![]() |
# element-popover
|
||
|
> A element-popover component for Vue.js.
|
||
|
|
||
|
## Demo
|
||
|
http://element-component.github.io/element-popover
|
||
|
|
||
|
## Installation
|
||
|
```shell
|
||
|
npm i element-popover -D
|
||
|
```
|
||
|
|
||
|
## Usage
|
||
|
```javascript
|
||
|
import Vue from 'vue'
|
||
|
import ElPopover from 'element-popover'
|
||
|
import 'element-theme-default/dist/popover.css'
|
||
|
|
||
|
Vue.use(ElPopover)
|
||
|
```
|
||
|
|
||
|
or
|
||
|
|
||
|
```javascript
|
||
|
import Vue from 'vue'
|
||
|
import ElPopover from 'element-popover'
|
||
|
|
||
|
Vue.component('el-popover', ElPopover)
|
||
|
```
|
||
|
|
||
|
|
||
|
### Attributes
|
||
|
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||
|
|--------------------|----------------------------------------------------------|-------------------|-------------|--------|
|
||
|
| trigger | 触发方式 | String | click/focus/hover/manual | click |
|
||
|
| title | 标题 | String | — | — |
|
||
|
| content | 显示的内容,也可以通过 `slot` 传入 DOM | String | — | — |
|
||
|
| width | 宽度 | String, Number | — | 最小宽度 150px |
|
||
|
| placement | 出现位置 | String | top/top-start/top-end/bottom/bottom-start/bottom-end/left/left-start/left-end/right/right-start/right-end | bottom |
|
||
|
| value(v-model) | 状态是否可见 | Boolean | — | false |
|
||
|
| offset | 出现位置的偏移量 | Number | — | 0 |
|
||
|
| transition | 定义渐变动画 | String | — | fade-in-linear |
|
||
|
| visible-arrow | 是否显示 Tooltip 箭头,更多参数可见[Vue-popper](https://github.com/element-component/vue-popper) | Boolean | — | true |
|
||
|
| options | [popper.js](https://popper.js.org/documentation.html) 的参数 | Object | 参考 [popper.js](https://popper.js.org/documentation.html) 文档 | `{ boundariesElement: 'body', gpuAcceleration: false }` |
|
||
|
| popper-class | 为 popper 添加类名 | String | - | -|
|
||
|
|
||
|
### Slot
|
||
|
| 参数 | 说明 |
|
||
|
|--- | ---|
|
||
|
| — | Popover 内嵌 HTML 文本 |
|
||
|
| reference | 触发 Popover 显示的 HTML 元素 |
|
||
|
|
||
|
### Events
|
||
|
| 事件名称 | 说明 | 回调参数 |
|
||
|
|---------|--------|---------|
|
||
|
| show | 显示时触发 | — |
|
||
|
| hide | 隐藏时触发 | — |
|
||
|
|
||
|
|
||
|
## Development
|
||
|
```shell
|
||
|
make dev
|
||
|
|
||
|
## test
|
||
|
make test
|
||
|
|
||
|
## build
|
||
|
make build
|
||
|
```
|
||
|
|
||
|
# License
|
||
|
[MIT](https://opensource.org/licenses/MIT)
|