mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
[Improvement] add overlay component (#442)
This commit is contained in:
parent
44f7581ae2
commit
bf4eb7c3e7
@ -1,11 +1,17 @@
|
|||||||
Component({
|
Component({
|
||||||
properties: {
|
properties: {
|
||||||
show: Boolean
|
show: Boolean,
|
||||||
|
mask: Boolean,
|
||||||
|
customStyle: String,
|
||||||
|
zIndex: {
|
||||||
|
type: Number,
|
||||||
|
value: 1
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onClickOverlay() {
|
onClick() {
|
||||||
|
this.triggerEvent('click');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
{
|
{
|
||||||
"component": true
|
"component": true,
|
||||||
|
"usingComponents": {
|
||||||
|
"van-transition": "../transition/index"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
.van-overlay {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
<view
|
<van-transition
|
||||||
class="overlay-class van-popup__overlay {{ show ? 'van-popup--show' : '' }}"
|
show="{{ show }}"
|
||||||
style="{{ overlayStyle }}"
|
custom-class="van-overlay"
|
||||||
bind:tap="onClickOverlay"
|
custom-style="z-index: {{ zIndex }}; {{ mask ? 'background-color: rgba(0, 0, 0, .7);' : '' }}; {{ customStyle }}"
|
||||||
|
bind:tap="onClick"
|
||||||
/>
|
/>
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"van-icon": "../icon/index",
|
"van-icon": "../icon/index",
|
||||||
"van-loading": "../loading/index",
|
"van-loading": "../loading/index",
|
||||||
|
"van-overlay": "../overlay/index",
|
||||||
"van-transition": "../transition/index"
|
"van-transition": "../transition/index"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,15 +21,6 @@
|
|||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
}
|
}
|
||||||
|
|
||||||
&__overlay {
|
|
||||||
z-index: 3000;
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--text {
|
&--text {
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
min-width: 220px;
|
min-width: 220px;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<van-transition
|
<van-overlay
|
||||||
show="{{ show && (mask || forbidClick) }}"
|
show="{{ show && (mask || forbidClick) }}"
|
||||||
custom-class="van-toast__overlay"
|
mask="{{ mask }}"
|
||||||
custom-style="{{ mask ? 'background-color: rgba(0, 0, 0, .7);' : '' }}"
|
z-index="3000"
|
||||||
/>
|
/>
|
||||||
<van-transition
|
<van-transition
|
||||||
show="{{ show }}"
|
show="{{ show }}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user