mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-24 00:39:32 +09:00
fix(client): nextTickの中でonUnmounted呼び出しても効かない可能性がある
This commit is contained in:
parent
1c6ab5447d
commit
642a51a558
@ -180,12 +180,12 @@ const setPosition = () => {
|
|||||||
el.value.style.top = top + 'px';
|
el.value.style.top = top + 'px';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let loopHandler;
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
setPosition();
|
setPosition();
|
||||||
|
|
||||||
let loopHandler;
|
|
||||||
|
|
||||||
const loop = () => {
|
const loop = () => {
|
||||||
loopHandler = window.requestAnimationFrame(() => {
|
loopHandler = window.requestAnimationFrame(() => {
|
||||||
setPosition();
|
setPosition();
|
||||||
@ -194,12 +194,12 @@ onMounted(() => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
loop();
|
loop();
|
||||||
|
|
||||||
onUnmounted(() => {
|
|
||||||
window.cancelAnimationFrame(loopHandler);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
window.cancelAnimationFrame(loopHandler);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
Loading…
Reference in New Issue
Block a user