mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
feat(Rate): improve touchmove gesture (#2088)
This commit is contained in:
parent
f3c063ae0d
commit
89bcab7b09
@ -91,19 +91,13 @@ VantComponent({
|
|||||||
const { touchable } = this.data;
|
const { touchable } = this.data;
|
||||||
if (!touchable) return;
|
if (!touchable) return;
|
||||||
|
|
||||||
const { clientX, clientY } = event.touches[0];
|
const { clientX } = event.touches[0];
|
||||||
|
|
||||||
this.getRect('.van-rate__icon', true).then(
|
this.getRect('.van-rate__icon', true).then(
|
||||||
(list: WechatMiniprogram.BoundingClientRectCallbackResult[]) => {
|
(list: WechatMiniprogram.BoundingClientRectCallbackResult[]) => {
|
||||||
const target = list
|
const target = list
|
||||||
.sort(item => item.right - item.left)
|
.sort(item => item.right - item.left)
|
||||||
.find(
|
.find(item => clientX >= item.left && clientX <= item.right);
|
||||||
item =>
|
|
||||||
clientX >= item.left &&
|
|
||||||
clientX <= item.right &&
|
|
||||||
clientY >= item.top &&
|
|
||||||
clientY <= item.bottom
|
|
||||||
);
|
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
this.onSelect({
|
this.onSelect({
|
||||||
...event,
|
...event,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user