[improvement] Popup: support custom style (#598)

This commit is contained in:
neverland 2018-09-19 15:44:08 +08:00 committed by GitHub
parent 265ce6a982
commit 2c11ae3193
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View File

@ -46,13 +46,14 @@ Page({
| 参数 | 说明 | 类型 | 默认值 |
|-----------|-----------|-----------|-------------|
| show | 当前组件是否显示 | `Boolean` | `false` |
| show | 是否显示弹出层 | `Boolean` | `false` |
| z-index | z-index 层级 | `Number` | `100` |
| overlay | 是否显示背景蒙层 | `Boolean` | `true` |
| position | 可选值为 `top` `bottom` `right` `left` | `String` | - |
| overlay-style | 自定义蒙层样式 | `String` | `` |
| close-on-click-overlay | 点击蒙层是否关闭 Popup | `Boolean` | `true` |
| z-index | z-index 层级 | `Number` | `100` |
| duration | 动画时长,单位为毫秒 | `Number` | `300` |
| custom-style | 自定义弹出层样式 | `String` | `` |
| overlay-style | 自定义背景蒙层样式 | `String` | `` |
| close-on-click-overlay | 点击蒙层是否关闭 Popup | `Boolean` | `true` |
### Event

View File

@ -6,6 +6,7 @@ create({
props: {
transition: String,
customStyle: String,
overlayStyle: String,
zIndex: {
type: Number,

View File

@ -8,7 +8,7 @@
<view
wx:if="{{ inited }}"
class="custom-class van-popup {{ position ? 'van-popup--' + position : '' }}"
style="z-index: {{ zIndex }}; animation-name: van-{{ transition || position }}-{{ type }}; animation-duration: {{ duration }}ms; {{ display ? '' : 'display: none;' }}"
style="z-index: {{ zIndex }}; animation-name: van-{{ transition || position }}-{{ type }}; animation-duration: {{ duration }}ms; {{ display ? '' : 'display: none;' }}{{ customStyle }}"
bind:animationend="onAnimationEnd"
>
<slot />