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