Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
data-table
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2025-11-18 19:59:50 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6d140780905e66e271949e70de9e64858383b423
6d140780
1 parent
02d1efdd
fix: 在组件卸载时清理定时器防止内存泄漏
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
src/App.vue
src/App.vue
View file @
6d14078
...
...
@@ -63,6 +63,14 @@ const is_wx = computed(() => wxInfo().isWeiXin);
// iframe模式判断
const is_iframe = computed(() => window.self !== window.top);
// 组件卸载时清理定时器(必须在 setup 同步阶段注册钩子)
let upDater = null;
onUnmounted(() => {
if (upDater) {
upDater.destroy();
}
});
onMounted(async () => {
// 重置弹框状态,确保每次访问页面时都能正常显示未完成表单弹框
resetDialogState();
...
...
@@ -242,7 +250,6 @@ onMounted(async () => {
}
// TAG:检查是否更新
let upDater = null;
if (import.meta.env.PROD) {
upDater = new Updater({
time: 30000
...
...
@@ -261,12 +268,6 @@ onMounted(async () => {
})
}
// 组件卸载时清理定时器
onUnmounted(() => {
if (upDater) {
upDater.destroy();
}
});
});
</script>
...
...
Please
register
or
login
to post a comment