mirror of
https://github.com/hotomoe/hotomoe
synced 2024-12-12 13:48:12 +09:00
enhance(frontend/PullToRefresh): コンポーネントがDOMから消えた時点でタッチ操作などのコールバック関数が止まるように (MisskeyIO#244)
This commit is contained in:
parent
5c4dfd3948
commit
3f5d0c60dd
@ -24,8 +24,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
<script lang="ts" setup>
|
||||
import MkLoading from '@/components/global/MkLoading.vue';
|
||||
import { onMounted, onUnmounted, watch } from 'vue';
|
||||
import { deviceKind } from '@/scripts/device-kind.js';
|
||||
import { onMounted, onUnmounted, onActivated, onDeactivated } from 'vue';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { getScrollContainer } from '@/scripts/scroll.js';
|
||||
|
||||
@ -197,6 +196,7 @@ function onScrollContainerScroll() {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
isRefreshing = false;
|
||||
if (rootEl == null) return;
|
||||
scrollEl = getScrollContainer(rootEl);
|
||||
if (scrollEl == null) return;
|
||||
@ -206,7 +206,18 @@ onMounted(() => {
|
||||
rootEl.addEventListener('touchend', moveEnd, { passive: true });
|
||||
});
|
||||
|
||||
onActivated(() => {
|
||||
isRefreshing = false;
|
||||
});
|
||||
|
||||
onDeactivated(() => {
|
||||
scrollEl!.style.touchAction = 'auto';
|
||||
isRefreshing = true;
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
scrollEl!.style.touchAction = 'auto';
|
||||
isRefreshing = true;
|
||||
if (scrollEl) scrollEl.removeEventListener('scroll', onScrollContainerScroll);
|
||||
if (rootEl == null) return;
|
||||
rootEl.removeEventListener('touchstart', moveStart);
|
||||
|
Loading…
Reference in New Issue
Block a user