From 83da58e0300c123b47e050f0d6ce499c7e0e052f Mon Sep 17 00:00:00 2001 From: neverland Date: Thu, 13 Sep 2018 19:19:34 +0800 Subject: [PATCH] [improvement] Toast: add z-index prop (#571) --- dist/toast/index.js | 4 ++++ dist/toast/index.wxml | 3 ++- dist/toast/index.wxss | 2 +- dist/toast/toast.js | 1 + packages/toast/README.md | 1 + packages/toast/index.js | 4 ++++ packages/toast/index.pcss | 1 - packages/toast/index.wxml | 3 ++- packages/toast/toast.js | 1 + 9 files changed, 16 insertions(+), 4 deletions(-) diff --git a/dist/toast/index.js b/dist/toast/index.js index 33aa2369..ca772164 100644 --- a/dist/toast/index.js +++ b/dist/toast/index.js @@ -6,6 +6,10 @@ create({ mask: Boolean, message: String, forbidClick: Boolean, + zIndex: { + type: Number, + value: 1000 + }, type: { type: String, value: 'text' diff --git a/dist/toast/index.wxml b/dist/toast/index.wxml index 2587219b..e4922806 100644 --- a/dist/toast/index.wxml +++ b/dist/toast/index.wxml @@ -1,10 +1,11 @@ diff --git a/dist/toast/index.wxss b/dist/toast/index.wxss index 4b0ce0d1..fbe40f19 100644 --- a/dist/toast/index.wxss +++ b/dist/toast/index.wxss @@ -1 +1 @@ -.van-toast{display:-webkit-box;display:-webkit-flex;display:flex;color:#fff;font-size:12px;line-height:1.2;border-radius:5px;word-break:break-all;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;box-sizing:border-box;background-color:rgba(0,0,0,.7)}.van-toast__container{top:50%;left:50%;z-index:3001;position:fixed;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.van-toast--text{padding:12px;min-width:220px}.van-toast--icon{width:120px;min-height:120px;padding:15px}.van-toast--icon .van-toast__icon{height:1em;font-size:50px}.van-toast--icon .van-toast__text{font-size:14px;padding-top:10px}.van-toast__loading{margin:10px 0 5px}.van-toast--top{-webkit-transform:translate(0,-30vh);transform:translate(0,-30vh)}.van-toast--bottom{-webkit-transform:translate(0,30vh);transform:translate(0,30vh)} \ No newline at end of file +.van-toast{display:-webkit-box;display:-webkit-flex;display:flex;color:#fff;font-size:12px;line-height:1.2;border-radius:5px;word-break:break-all;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;box-sizing:border-box;background-color:rgba(0,0,0,.7)}.van-toast__container{top:50%;left:50%;position:fixed;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.van-toast--text{padding:12px;min-width:220px}.van-toast--icon{width:120px;min-height:120px;padding:15px}.van-toast--icon .van-toast__icon{height:1em;font-size:50px}.van-toast--icon .van-toast__text{font-size:14px;padding-top:10px}.van-toast__loading{margin:10px 0 5px}.van-toast--top{-webkit-transform:translate(0,-30vh);transform:translate(0,-30vh)}.van-toast--bottom{-webkit-transform:translate(0,30vh);transform:translate(0,30vh)} \ No newline at end of file diff --git a/dist/toast/toast.js b/dist/toast/toast.js index 44352605..5c491e9e 100644 --- a/dist/toast/toast.js +++ b/dist/toast/toast.js @@ -5,6 +5,7 @@ const defaultOptions = { mask: false, message: '', show: true, + zIndex: 1000, duration: 3000, position: 'middle', forbidClick: false, diff --git a/packages/toast/README.md b/packages/toast/README.md index ee1c2c96..fe9fded1 100644 --- a/packages/toast/README.md +++ b/packages/toast/README.md @@ -92,5 +92,6 @@ const timer = setInterval(() => { | mask | 是否显示背景蒙层 | `Boolean` | `false` | | forbidClick | 是否禁止背景点击 | `Boolean` | `false` | | loadingType | 加载图标类型, 可选值为 `spinner` | `String` | `circular` | +| zIndex | z-index 层级 | `Number` | `1000` | | duration | 展示时长(ms),值为 0 时,toast 不会消失 | `Number` | `3000` | | selector | 自定义选择器 | `String` | `van-toast` | diff --git a/packages/toast/index.js b/packages/toast/index.js index 33aa2369..ca772164 100644 --- a/packages/toast/index.js +++ b/packages/toast/index.js @@ -6,6 +6,10 @@ create({ mask: Boolean, message: String, forbidClick: Boolean, + zIndex: { + type: Number, + value: 1000 + }, type: { type: String, value: 'text' diff --git a/packages/toast/index.pcss b/packages/toast/index.pcss index c6463d4d..df7a5a0b 100644 --- a/packages/toast/index.pcss +++ b/packages/toast/index.pcss @@ -16,7 +16,6 @@ &__container { top: 50%; left: 50%; - z-index: 3001; position: fixed; transform: translate(-50%, -50%); } diff --git a/packages/toast/index.wxml b/packages/toast/index.wxml index 2587219b..e4922806 100644 --- a/packages/toast/index.wxml +++ b/packages/toast/index.wxml @@ -1,10 +1,11 @@ diff --git a/packages/toast/toast.js b/packages/toast/toast.js index 44352605..5c491e9e 100644 --- a/packages/toast/toast.js +++ b/packages/toast/toast.js @@ -5,6 +5,7 @@ const defaultOptions = { mask: false, message: '', show: true, + zIndex: 1000, duration: 3000, position: 'middle', forbidClick: false,