File tree Expand file tree Collapse file tree 4 files changed +18
-13
lines changed Expand file tree Collapse file tree 4 files changed +18
-13
lines changed Original file line number Diff line number Diff line change 1
1
<view wx:if="{{show}}" class="container-popup l-class" style="z-index:{{zIndex}};" catchtouchmove="doNothing">
2
- <view class=" container-bg container-bg-{{status}} l-bg-class" ></view>
2
+ <view class=' container-bg container-bg-{{animation ? status:"" }} l-bg-class' ></view>
3
3
<view class="popup-content {{ show ? contentAlign : ''}} popup-fade-{{contentAlign}}-active-{{animation ? status:''}} l-panel-class" catchtap="onPopupTap">
4
4
<view catchtap="doNothing">
5
5
<slot></slot>
Original file line number Diff line number Diff line change @@ -89,17 +89,29 @@ Component({
89
89
// 点击事件
90
90
onPopupTap ( ) {
91
91
if ( this . data . locked !== true ) {
92
+ this . _hidePopup ( ) ;
93
+ }
94
+
95
+ eventUtil . emit ( this , 'lintap' ) ;
96
+ } ,
97
+
98
+ _hidePopup ( ) {
99
+ if ( this . data . animation ) {
92
100
this . setData ( {
93
101
status : 'hide'
94
102
} ) ;
103
+ // 延迟 300ms 等动画结束再去掉节点
95
104
setTimeout ( ( ) => {
96
105
this . setData ( {
97
106
show : false
98
107
} ) ;
99
108
} , 300 ) ;
109
+ } else {
110
+ this . setData ( {
111
+ show : false ,
112
+ status : 'hide'
113
+ } ) ;
100
114
}
101
-
102
- eventUtil . emit ( this , 'lintap' ) ;
103
115
} ,
104
116
105
117
// ================= 开放函数 ========================
@@ -127,14 +139,7 @@ Component({
127
139
* 会忽略 locked 属性
128
140
*/
129
141
linHide ( ) {
130
- this . setData ( {
131
- status : 'hide'
132
- } ) ;
133
- setTimeout ( ( ) => {
134
- this . setData ( {
135
- show : false
136
- } ) ;
137
- } , 300 ) ;
142
+ this . _hidePopup ( ) ;
138
143
}
139
144
}
140
145
} ) ;
Original file line number Diff line number Diff line change 1
1
<view wx:if="{{show}}" class='container-popup l-class'
2
2
style="z-index:{{zIndex}}; "
3
3
catchtouchmove="doNothing">
4
- <view class='container-bg container-bg-{{status}} l-bg-class'></view>
4
+ <view class='container-bg container-bg-{{animation ? status:"" }} l-bg-class'></view>
5
5
<view
6
6
class="popup-content {{ show ? contentAlign : ''}} popup-fade-{{contentAlign}}-active-{{animation ? status:''}} l-panel-class"
7
7
catchtap='onPopupTap'>
You can’t perform that action at this time.
0 commit comments