fix(version-check): clear localStorage if need

This commit is contained in:
yangsy
2025-11-19 13:54:41 +08:00
parent 5fa668acd3
commit dfbdc6d828
4 changed files with 17 additions and 1 deletions

View File

@@ -1,11 +1,13 @@
import type { VersionInfo } from '@/apis/domains/version-info';
import { useQuery } from '@tanstack/vue-query';
import axios from 'axios';
import { useThemeVars } from 'naive-ui';
import { h, ref, watch } from 'vue';
export function useVersionCheckQuery() {
const localVersionInfo = ref<VersionInfo>();
const dialogShow = ref<boolean>(false);
const themeVars = useThemeVars();
const { data: remoteVersionInfo, dataUpdatedAt } = useQuery({
queryKey: ['version-check'],
@@ -37,6 +39,7 @@ export function useVersionCheckQuery() {
h('div', {}, { default: () => `当前版本:${localVersionInfo.value?.version}` }),
h('div', {}, { default: () => `最新版本:${newVersionInfo.version}` }),
h('div', {}, { default: () => '请点击刷新页面以更新' }),
h('div', { style: { marginTop: '8px', fontWeight: '700', color: themeVars.value.warningColor } }, { default: () => '⚠️ 注意,更新后可能需要重新登录!' }),
]),
positiveText: '刷新页面',
maskClosable: false,