optimize(utils): Reduce code indentation and improve readability (#496)

This commit is contained in:
青菜白玉汤 2024-06-14 18:24:56 +08:00 committed by GitHub
parent cd9d58d4de
commit ad2f24707a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -12,40 +12,42 @@ export function setupAppVersionNotification() {
const buildTime = await getHtmlBuildTime();
if (buildTime !== BUILD_TIME) {
isShow = true;
const n = window.$notification?.create({
title: $t('system.updateTitle'),
content: $t('system.updateContent'),
action() {
return h('div', { style: { display: 'flex', justifyContent: 'end', gap: '12px', width: '325px' } }, [
h(
NButton,
{
onClick() {
n?.destroy();
}
},
() => $t('system.updateCancel')
),
h(
NButton,
{
type: 'primary',
onClick() {
location.reload();
}
},
() => $t('system.updateConfirm')
)
]);
},
onClose() {
isShow = false;
}
});
if (buildTime === BUILD_TIME) {
return;
}
isShow = true;
const n = window.$notification?.create({
title: $t('system.updateTitle'),
content: $t('system.updateContent'),
action() {
return h('div', { style: { display: 'flex', justifyContent: 'end', gap: '12px', width: '325px' } }, [
h(
NButton,
{
onClick() {
n?.destroy();
}
},
() => $t('system.updateCancel')
),
h(
NButton,
{
type: 'primary',
onClick() {
location.reload();
}
},
() => $t('system.updateConfirm')
)
]);
},
onClose() {
isShow = false;
}
});
});
}