fix: 清除生成中loading
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<script lang="ts" setup>
|
||||
import type { LicenseApi } from '#/api/license/license';
|
||||
|
||||
import { onBeforeUnmount, ref } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { onBeforeUnmount, onUnmounted, ref } from 'vue';
|
||||
import { onBeforeRouteLeave, useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import { useAccess } from '@vben/access';
|
||||
import { Page } from '@vben/common-ui';
|
||||
@@ -60,7 +60,7 @@ async function onGenerate() {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('license.generating'),
|
||||
duration: 0,
|
||||
key: 'action_process_msg',
|
||||
key: 'generate_process_msg',
|
||||
});
|
||||
|
||||
await generateLicense(formData.value.id);
|
||||
@@ -127,6 +127,21 @@ async function onDownload() {
|
||||
|
||||
// 组件卸载前清理
|
||||
onBeforeUnmount(() => {
|
||||
message.destroy('generate_process_msg');
|
||||
if (checkInterval) clearInterval(checkInterval);
|
||||
if (timeoutTimer) clearTimeout(timeoutTimer);
|
||||
});
|
||||
|
||||
// 组件卸载时清理
|
||||
onUnmounted(() => {
|
||||
message.destroy('generate_process_msg');
|
||||
if (checkInterval) clearInterval(checkInterval);
|
||||
if (timeoutTimer) clearTimeout(timeoutTimer);
|
||||
});
|
||||
|
||||
/** 离开页面时自动清理 */
|
||||
onBeforeRouteLeave(() => {
|
||||
message.destroy('generate_process_msg');
|
||||
if (checkInterval) clearInterval(checkInterval);
|
||||
if (timeoutTimer) clearTimeout(timeoutTimer);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user