mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-24 19:28:11 +00:00
移动端内通知手势上滑动关闭
This commit is contained in:
parent
8358a10ce8
commit
8a49eb742e
@ -1,6 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<transition v-if="show && userid > 0" name="mobile-notify">
|
<transition v-if="show && userid > 0" name="mobile-notify">
|
||||||
<div class="mobile-notification" :class="{show}" @click.stop="onClick">
|
<div
|
||||||
|
class="mobile-notification"
|
||||||
|
:class="{show}"
|
||||||
|
@click.stop="onClick"
|
||||||
|
@touchstart="onTouchstart"
|
||||||
|
@touchmove="onTouchmove">
|
||||||
<UserAvatar :userid="userid" :size="40" show-name/>
|
<UserAvatar :userid="userid" :size="40" show-name/>
|
||||||
<div class="notification-desc">{{desc}}</div>
|
<div class="notification-desc">{{desc}}</div>
|
||||||
</div>
|
</div>
|
||||||
@ -19,6 +24,8 @@ export default {
|
|||||||
|
|
||||||
show: false,
|
show: false,
|
||||||
timer: null,
|
timer: null,
|
||||||
|
|
||||||
|
startY: 0,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -56,7 +63,18 @@ export default {
|
|||||||
if (typeof this.callback === "function") {
|
if (typeof this.callback === "function") {
|
||||||
this.callback();
|
this.callback();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
|
onTouchstart(e) {
|
||||||
|
this.startY = e.touches[0].clientY;
|
||||||
|
},
|
||||||
|
|
||||||
|
onTouchmove(e) {
|
||||||
|
if (this.startY > 0 && this.startY - e.touches[0].clientY > 10) {
|
||||||
|
this.startY = 0;
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user