Skip to content

Commit

Permalink
feat: picker fullyStop 增加兜底逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
QiuShuiBai committed Oct 17, 2024
1 parent 06cd79d commit c99ece4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Binary file added packages/mpx-cube-ui/lib.zip
Binary file not shown.
20 changes: 18 additions & 2 deletions packages/mpx-cube-ui/src/common/mixins/picker-popup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export default getMixin({
}
},
data: {
pickStartCount: 0
pickStartCount: 0,
timeoutCount: 0,
timeoutArr: [] as number[]
},
methods: {
// 不能通过 pickstart 及 pickend 来判断
Expand All @@ -29,13 +31,22 @@ export default getMixin({
this.pickStartCount = 0
}
this.pickStartCount++
const timer = setTimeout(() => {
this.timeoutCount++
this.pickStartCount--
}, 3000) as unknown as number
this.timeoutArr.push(timer)
}
// 当滚动选择开始时候触发事件
this.triggerEvent(EVENT_PICK_START, e.detail)
},
onPickend(e) {
if (this.fullyStop) {
this.pickStartCount--
if (this.timeoutCount > 0) {
this.timeoutCount--
} else {
this.pickStartCount--
}
}
// 当滚动选择结束时候触发事件
this.triggerEvent(EVENT_PICK_END, e.detail)
Expand Down Expand Up @@ -66,6 +77,11 @@ export default getMixin({
return
}
this.pickStartCount = 0
this.timeoutCount = 0
this.timeoutArr.forEach(timer => {
clearTimeout(timer)
})
this.timeoutArr = []
}
this.hide()
const {
Expand Down

0 comments on commit c99ece4

Please sign in to comment.