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';
|
||||
};
|
||||
|
||||
let loopHandler;
|
||||
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
setPosition();
|
||||
|
||||
let loopHandler;
|
||||
|
||||
const loop = () => {
|
||||
loopHandler = window.requestAnimationFrame(() => {
|
||||
setPosition();
|
||||
|
@ -194,11 +194,11 @@ onMounted(() => {
|
|||
};
|
||||
|
||||
loop();
|
||||
});
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
onUnmounted(() => {
|
||||
window.cancelAnimationFrame(loopHandler);
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue