Skip to content

Commit ad2f247

Browse files
authored
optimize(utils): Reduce code indentation and improve readability (#496)
1 parent cd9d58d commit ad2f247

File tree

1 file changed

+35
-33
lines changed

1 file changed

+35
-33
lines changed

src/plugins/app.ts

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,42 @@ export function setupAppVersionNotification() {
1212

1313
const buildTime = await getHtmlBuildTime();
1414

15-
if (buildTime !== BUILD_TIME) {
16-
isShow = true;
17-
18-
const n = window.$notification?.create({
19-
title: $t('system.updateTitle'),
20-
content: $t('system.updateContent'),
21-
action() {
22-
return h('div', { style: { display: 'flex', justifyContent: 'end', gap: '12px', width: '325px' } }, [
23-
h(
24-
NButton,
25-
{
26-
onClick() {
27-
n?.destroy();
28-
}
29-
},
30-
() => $t('system.updateCancel')
31-
),
32-
h(
33-
NButton,
34-
{
35-
type: 'primary',
36-
onClick() {
37-
location.reload();
38-
}
39-
},
40-
() => $t('system.updateConfirm')
41-
)
42-
]);
43-
},
44-
onClose() {
45-
isShow = false;
46-
}
47-
});
15+
if (buildTime === BUILD_TIME) {
16+
return;
4817
}
18+
19+
isShow = true;
20+
21+
const n = window.$notification?.create({
22+
title: $t('system.updateTitle'),
23+
content: $t('system.updateContent'),
24+
action() {
25+
return h('div', { style: { display: 'flex', justifyContent: 'end', gap: '12px', width: '325px' } }, [
26+
h(
27+
NButton,
28+
{
29+
onClick() {
30+
n?.destroy();
31+
}
32+
},
33+
() => $t('system.updateCancel')
34+
),
35+
h(
36+
NButton,
37+
{
38+
type: 'primary',
39+
onClick() {
40+
location.reload();
41+
}
42+
},
43+
() => $t('system.updateConfirm')
44+
)
45+
]);
46+
},
47+
onClose() {
48+
isShow = false;
49+
}
50+
});
4951
});
5052
}
5153

0 commit comments

Comments
 (0)