Skip to content

Commit cf3193b

Browse files
committed
feat: better page-container popup
1 parent ed98baf commit cf3193b

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

miniprogram/packageComponent/pages/view/page-container/page-container.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ Page({
3131
})
3232
}
3333
},
34-
popup(e) {
35-
const position = e.currentTarget.dataset.position
34+
doPopup(position) {
3635
let customStyle = ''
3736
const duration = this.data.duration
3837
switch (position) {
@@ -45,16 +44,23 @@ Page({
4544
}
4645
this.setData({
4746
position,
48-
show: true,
4947
customStyle,
5048
duration
49+
}, () => {
50+
this.setData({ show: true })
5151
})
5252
},
53+
popup(e) {
54+
const position = e.currentTarget.dataset.position
55+
this.doPopup(position)
56+
},
5357
changeRound() {
5458
this.setData({ round: !this.data.round })
59+
this.doPopup('bottom')
5560
},
5661
changeOverlay() {
57-
this.setData({ overlay: !this.data.overlay, show: true })
62+
this.setData({ overlay: !this.data.overlay })
63+
this.doPopup('bottom')
5864
},
5965
changeOverlayStyle(e) {
6066
let overlayStyle = ''
@@ -69,7 +75,8 @@ Page({
6975
case 'blur':
7076
overlayStyle = 'background-color: rgba(0, 0, 0, 0.7); filter: blur(4px);'
7177
}
72-
this.setData({ overlayStyle, show: true })
78+
this.setData({ overlayStyle })
79+
this.doPopup('bottom')
7380
},
7481
exit() {
7582
this.setData({ show: false })

0 commit comments

Comments
 (0)