mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 18:07:31 -07:00
fix(client): nextTickの中でonUnmounted呼び出しても効かない可能性がある
This commit is contained in:
parent
73b1bf76ed
commit
b6093a9d90
1 changed files with 6 additions and 6 deletions
|
@ -180,12 +180,12 @@ const setPosition = () => {
|
|||
el.value.style.top = top + 'px';
|
||||
};
|
||||
|
||||
let loopHandler;
|
||||
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
setPosition();
|
||||
|
||||
let loopHandler;
|
||||
|
||||
const loop = () => {
|
||||
loopHandler = window.requestAnimationFrame(() => {
|
||||
setPosition();
|
||||
|
@ -194,12 +194,12 @@ onMounted(() => {
|
|||
};
|
||||
|
||||
loop();
|
||||
});
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
window.cancelAnimationFrame(loopHandler);
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
Loading…
Reference in a new issue