[improvement] Popup: add z-index prop (#572)

This commit is contained in:
neverland 2018-09-13 19:31:28 +08:00 committed by GitHub
parent 83da58e030
commit 54d548a7b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 2 deletions

View File

@ -51,6 +51,7 @@ Page({
| 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` |
### Event

View File

@ -7,6 +7,10 @@ create({
props: {
transition: String,
overlayStyle: String,
zIndex: {
type: Number,
value: 100
},
overlay: {
type: Boolean,
value: true

View File

@ -3,7 +3,6 @@
.van-popup {
top: 50%;
left: 50%;
z-index: 11;
position: fixed;
max-height: 100%;
overflow-y: auto;

View File

@ -1,13 +1,14 @@
<van-overlay
mask
show="{{ overlay && show }}"
z-index="{{ zIndex }}"
custom-style="{{ overlayStyle }}"
bind:click="onClickOverlay"
/>
<view
wx:if="{{ inited }}"
class="custom-class van-popup {{ position ? 'van-popup--' + position : '' }}"
style="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;' }}"
bind:animationend="onAnimationEnd"
>
<slot />