feat: eslint

This commit is contained in:
pk5ls20
2024-11-25 20:02:50 +08:00
parent 7fba9960bf
commit 4be821137d
13 changed files with 273 additions and 233 deletions

View File

@@ -3,20 +3,15 @@
<router-view />
</div>
<div v-if="show">
<t-sticky-tool
shape="round"
placement="right-bottom"
:offset="[-50, 10]"
@click="changeTheme"
>
<t-sticky-item label="浅色" popup="切换浅色模式" >
<template #icon><sunny-icon/></template>
<t-sticky-tool shape="round" placement="right-bottom" :offset="[-50, 10]" @click="changeTheme">
<t-sticky-item label="浅色" popup="切换浅色模式">
<template #icon><sunny-icon /></template>
</t-sticky-item>
<t-sticky-item label="深色" popup="切换深色模式" >
<template #icon><mode-dark-icon/></template>
<t-sticky-item label="深色" popup="切换深色模式">
<template #icon><mode-dark-icon /></template>
</t-sticky-item>
<t-sticky-item label="自动" popup="跟随系统" >
<template #icon><control-platform-icon/></template>
<t-sticky-item label="自动" popup="跟随系统">
<template #icon><control-platform-icon /></template>
</t-sticky-item>
</t-sticky-tool>
</div>
@@ -40,11 +35,11 @@ enum ThemeMode {
Auto = 'auto',
}
const themeLabelMap: Record<string, ThemeMode> = {
'浅色': ThemeMode.Light,
'深色': ThemeMode.Dark,
'自动': ThemeMode.Auto,
浅色: ThemeMode.Light,
深色: ThemeMode.Dark,
自动: ThemeMode.Auto,
};
const show = ref<boolean>(true)
const show = ref<boolean>(true);
const createSetThemeAttributeFunction = () => {
let mediaQueryForAutoTheme: MediaQueryList | null = null;
return (mode: ThemeMode | null) => {
@@ -64,9 +59,9 @@ const createSetThemeAttributeFunction = () => {
};
mediaQueryForAutoTheme.addEventListener('change', handleMediaChange);
const event = new Event('change');
Object.defineProperty(event,'matches', {
Object.defineProperty(event, 'matches', {
value: mediaQueryForAutoTheme.matches,
writable: false
writable: false,
});
mediaQueryForAutoTheme.dispatchEvent(event);
onBeforeUnmount(() => {
@@ -107,13 +102,11 @@ const haddingFbars = () => {
};
onMounted(() => {
initTheme();
haddingFbars()
haddingFbars();
window.addEventListener('resize', haddingFbars);
});
onUnmounted(() => {
window.removeEventListener('resize', haddingFbars);
});
</script>
<style scoped>
</style>
<style scoped></style>