docs: clean up GlobalConfig type definition by moving it to a separate type file
parent
bbb7670df1
commit
252a0e2563
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent, provide, watch, ref } from 'vue';
|
||||
import type { Ref } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import useMediaQuery from './hooks/useMediaQuery';
|
||||
|
|
@ -21,16 +20,11 @@ import dayjs from 'dayjs';
|
|||
import 'dayjs/locale/zh-cn';
|
||||
import { theme as antdTheme } from 'ant-design-vue';
|
||||
import SiteToken from './SiteToken.vue';
|
||||
import type { GlobalConfig } from './type';
|
||||
function isZhCN(name: string) {
|
||||
return /-cn\/?$/.test(name);
|
||||
}
|
||||
export interface GlobalConfig {
|
||||
isMobile: Ref<boolean>;
|
||||
lang: Ref<'zh-CN' | 'en-US'>;
|
||||
isZhCN: Ref<boolean>;
|
||||
responsive: Ref<null | 'narrow' | 'crowded'>;
|
||||
blocked: Ref<boolean>;
|
||||
}
|
||||
|
||||
export type ThemeName = '' | 'light' | 'dark' | 'compact';
|
||||
const getAlgorithm = (themes: ThemeName[] = []) =>
|
||||
themes
|
||||
|
|
|
|||
|
|
@ -108,7 +108,6 @@
|
|||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import type { GlobalConfig } from '../App.vue';
|
||||
import { GLOBAL_CONFIG } from '../SymbolKey';
|
||||
import { defineComponent, inject, computed, ref, provide, watch } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
|
@ -129,6 +128,7 @@ import CompactIcon from './icons/Compact';
|
|||
import surelyVueVue from '../components/surelyVue.vue';
|
||||
import WWAdsVue from '../components/rice/WWAds.vue';
|
||||
import { useWindowScroll } from '@vueuse/core';
|
||||
import type { GlobalConfig } from '../type';
|
||||
|
||||
const rControl = /[\u0000-\u001f]/g;
|
||||
const rSpecial = /[\s~`!@#$%^&*()\-_+=[\]{}|\\;:"'<>,.?/]+/g;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
import type { Ref } from 'vue';
|
||||
export interface GlobalConfig {
|
||||
isMobile: Ref<boolean>;
|
||||
lang: Ref<'zh-CN' | 'en-US'>;
|
||||
isZhCN: Ref<boolean>;
|
||||
responsive: Ref<null | 'narrow' | 'crowded'>;
|
||||
blocked: Ref<boolean>;
|
||||
}
|
||||
Loading…
Reference in New Issue