[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` | - | | position | 可选值为 `top` `bottom` `right` `left` | `String` | - |
| overlay-style | 自定义蒙层样式 | `String` | `` | | overlay-style | 自定义蒙层样式 | `String` | `` |
| close-on-click-overlay | 点击蒙层是否关闭 Popup | `Boolean` | `true` | | close-on-click-overlay | 点击蒙层是否关闭 Popup | `Boolean` | `true` |
| z-index | z-index 层级 | `Number` | `100` |
| duration | 动画时长,单位为毫秒 | `Number` | `300` | | duration | 动画时长,单位为毫秒 | `Number` | `300` |
### Event ### Event

View File

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

View File

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

View File

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