优化返回手势抖动问题

This commit is contained in:
kuaifan 2022-06-03 11:41:50 +08:00
parent b855312cf9
commit 6c7c17cd61

View File

@ -44,11 +44,14 @@ export default {
}, },
computed: { computed: {
...mapState(['windowScrollY']), ...mapState(['windowHeight', 'windowScrollY']),
style() { style() {
const offset = 135;
const top = Math.max(offset, this.y) + this.windowScrollY,
maxTop = this.windowHeight - offset;
return { return {
top: (this.y + this.windowScrollY) + 'px', top: Math.min(top, maxTop) + 'px',
left: this.x > 20 ? 0 : '-50px', left: this.x > 20 ? 0 : '-50px',
} }
}, },