fix(projects): 修复globalFooter适应暗黑模式

This commit is contained in:
Soybean 2021-10-21 18:29:32 +08:00
parent b2854d57e8
commit 93f08d9067
5 changed files with 78 additions and 73 deletions

View File

@ -18,14 +18,14 @@
"*.{vue,js,jsx,ts,tsx}": "eslint --fix"
},
"dependencies": {
"@vueuse/core": "^6.6.2",
"@vueuse/core": "^6.7.3",
"axios": "^0.23.0",
"chroma-js": "^2.1.2",
"clipboard": "^2.0.8",
"dayjs": "^1.10.7",
"form-data": "^4.0.0",
"makeit-captcha": "^1.2.5",
"naive-ui": "^2.19.9",
"naive-ui": "^2.19.11",
"pinia": "^2.0.0-rc.14",
"qs": "^6.10.1",
"vue": "^3.2.20",
@ -62,7 +62,7 @@
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^7.20.0",
"husky": "^7.0.2",
"husky": "^7.0.4",
"lint-staged": "^11.2.3",
"patch-package": "^6.4.7",
"postinstall-postinstall": "^2.1.0",

View File

@ -21,7 +21,7 @@ specifiers:
'@vue/compiler-sfc': ^3.2.20
'@vue/eslint-config-prettier': ^6.0.0
'@vue/eslint-config-typescript': ^8.0.0
'@vueuse/core': ^6.6.2
'@vueuse/core': ^6.7.3
axios: ^0.23.0
chroma-js: ^2.1.2
clipboard: ^2.0.8
@ -37,10 +37,10 @@ specifiers:
eslint-plugin-prettier: ^4.0.0
eslint-plugin-vue: ^7.20.0
form-data: ^4.0.0
husky: ^7.0.2
husky: ^7.0.4
lint-staged: ^11.2.3
makeit-captcha: ^1.2.5
naive-ui: ^2.19.9
naive-ui: ^2.19.11
patch-package: ^6.4.7
pinia: ^2.0.0-rc.14
postinstall-postinstall: ^2.1.0
@ -61,14 +61,14 @@ specifiers:
windicss: ^3.1.9
dependencies:
'@vueuse/core': registry.npmmirror.com/@vueuse/core/6.6.2_vue@3.2.20
'@vueuse/core': registry.npmmirror.com/@vueuse/core/6.7.3_vue@3.2.20
axios: registry.npmmirror.com/axios/0.23.0
chroma-js: registry.nlark.com/chroma-js/2.1.2
clipboard: registry.nlark.com/clipboard/2.0.8
dayjs: registry.nlark.com/dayjs/1.10.7
form-data: 4.0.0
makeit-captcha: registry.npmmirror.com/makeit-captcha/1.2.5
naive-ui: registry.npmmirror.com/naive-ui/2.19.9_vue@3.2.20
naive-ui: registry.npmmirror.com/naive-ui/2.19.11_vue@3.2.20
pinia: registry.npmmirror.com/pinia/2.0.0-rc.14_typescript@4.4.4+vue@3.2.20
qs: 6.10.1
vue: registry.npmmirror.com/vue/3.2.20
@ -105,7 +105,7 @@ devDependencies:
eslint-plugin-import: registry.npmmirror.com/eslint-plugin-import/2.25.2_eslint@8.0.1
eslint-plugin-prettier: registry.nlark.com/eslint-plugin-prettier/4.0.0_15313026b01cdd263118061498e273ac
eslint-plugin-vue: registry.npmmirror.com/eslint-plugin-vue/7.20.0_eslint@8.0.1
husky: registry.nlark.com/husky/7.0.2
husky: registry.npmmirror.com/husky/7.0.4
lint-staged: registry.npmmirror.com/lint-staged/11.2.3
patch-package: registry.nlark.com/patch-package/6.4.7
postinstall-postinstall: registry.nlark.com/postinstall-postinstall/2.1.0
@ -146,11 +146,6 @@ packages:
engines: {node: '>=4'}
dev: true
/ansi-regex/3.0.0:
resolution: {integrity: sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=, tarball: ansi-regex/download/ansi-regex-3.0.0.tgz?cache=0&sync_timestamp=1618554239243&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fansi-regex%2Fdownload%2Fansi-regex-3.0.0.tgz}
engines: {node: '>=4'}
dev: true
/ansi-regex/4.1.0:
resolution: {integrity: sha1-i5+PCM8ay4Q3Vqg5yox+MWjFGZc=, tarball: ansi-regex/download/ansi-regex-4.1.0.tgz?cache=0&sync_timestamp=1618554239243&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fansi-regex%2Fdownload%2Fansi-regex-4.1.0.tgz}
engines: {node: '>=6'}
@ -622,7 +617,7 @@ packages:
resolution: {integrity: sha1-qEeQIusaw2iocTibY1JixQXuNo8=, tarball: strip-ansi/download/strip-ansi-4.0.0.tgz}
engines: {node: '>=4'}
dependencies:
ansi-regex: 3.0.0
ansi-regex: registry.nlark.com/ansi-regex/3.0.0
dev: true
/strip-ansi/5.2.0:
@ -985,13 +980,6 @@ packages:
name: '@types/yargs-parser'
version: 20.2.1
registry.nlark.com/@types/yargs/15.0.14:
resolution: {integrity: sha1-Jtgh3biecEkhYLZtEKDrbfj2+wY=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/@types/yargs/download/@types/yargs-15.0.14.tgz}
name: '@types/yargs'
version: 15.0.14
dependencies:
'@types/yargs-parser': registry.nlark.com/@types/yargs-parser/20.2.1
registry.nlark.com/@vicons/antd/0.11.0:
resolution: {integrity: sha1-PSiVLQKK7XEtymHLgdvbEUVMVUI=, registry: http://registry.npm.taobao.org/, tarball: https://registry.nlark.com/@vicons/antd/download/@vicons/antd-0.11.0.tgz}
name: '@vicons/antd'
@ -1125,18 +1113,18 @@ packages:
type-fest: registry.nlark.com/type-fest/0.21.3
dev: true
registry.nlark.com/ansi-regex/5.0.0:
resolution: {integrity: sha1-OIU59VF5vzkznIGvMKZU1p+Hy3U=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/ansi-regex/download/ansi-regex-5.0.0.tgz}
registry.nlark.com/ansi-regex/3.0.0:
resolution: {integrity: sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/ansi-regex/download/ansi-regex-3.0.0.tgz}
name: ansi-regex
version: 5.0.0
engines: {node: '>=8'}
version: 3.0.0
engines: {node: '>=4'}
dev: true
registry.nlark.com/ansi-regex/5.0.1:
resolution: {integrity: sha1-CCyyyJyf6GWaMRpTvWpNxTAdswQ=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/ansi-regex/download/ansi-regex-5.0.1.tgz}
name: ansi-regex
version: 5.0.1
engines: {node: '>=8'}
dev: true
registry.nlark.com/ansi-styles/3.2.1:
resolution: {integrity: sha1-QfuyAkPlCxK+DwS43tvwdSDOhB0=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/ansi-styles/download/ansi-styles-3.2.1.tgz}
@ -2644,14 +2632,6 @@ packages:
engines: {node: '>=10.17.0'}
dev: true
registry.nlark.com/husky/7.0.2:
resolution: {integrity: sha1-IZANoPMBmazKQ6RsBDxK2Erojf8=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/husky/download/husky-7.0.2.tgz}
name: husky
version: 7.0.2
engines: {node: '>=12'}
hasBin: true
dev: true
registry.nlark.com/iconv-lite/0.4.24:
resolution: {integrity: sha1-ICK0sl+93CHS9SSXSkdKr+czkIs=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/iconv-lite/download/iconv-lite-0.4.24.tgz?cache=0&sync_timestamp=1621826342262&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ficonv-lite%2Fdownload%2Ficonv-lite-0.4.24.tgz}
name: iconv-lite
@ -2966,12 +2946,6 @@ packages:
minimatch: registry.nlark.com/minimatch/3.0.4
dev: true
registry.nlark.com/jest-get-type/26.3.0:
resolution: {integrity: sha1-6X3Dw/U8K0Bsp6+u1Ek7HQmRmeA=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/jest-get-type/download/jest-get-type-26.3.0.tgz}
name: jest-get-type
version: 26.3.0
engines: {node: '>= 10.14.2'}
registry.nlark.com/js-stringify/1.0.2:
resolution: {integrity: sha1-Fzb939lyTyijaCrcYjCufk6Weds=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/js-stringify/download/js-stringify-1.0.2.tgz}
name: js-stringify
@ -4967,7 +4941,7 @@ packages:
'@types/istanbul-lib-coverage': registry.nlark.com/@types/istanbul-lib-coverage/2.0.3
'@types/istanbul-reports': registry.nlark.com/@types/istanbul-reports/3.0.1
'@types/node': registry.npmmirror.com/@types/node/16.6.2
'@types/yargs': registry.nlark.com/@types/yargs/15.0.14
'@types/yargs': registry.npmmirror.com/@types/yargs/15.0.14
chalk: registry.nlark.com/chalk/4.1.2
registry.npmmirror.com/@types/lodash/4.14.175:
@ -4991,6 +4965,13 @@ packages:
name: '@types/node'
version: 16.6.2
registry.npmmirror.com/@types/yargs/15.0.14:
resolution: {integrity: sha1-Jtgh3biecEkhYLZtEKDrbfj2+wY=, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@types/yargs/download/@types/yargs-15.0.14.tgz}
name: '@types/yargs'
version: 15.0.14
dependencies:
'@types/yargs-parser': registry.nlark.com/@types/yargs-parser/20.2.1
registry.npmmirror.com/@typescript-eslint/eslint-plugin/5.1.0_5c3e9dad3ab5199adbc8541e4d2d5a4f:
resolution: {integrity: sha1-OBwYjfqxL3ose2qLokAtYnPq3qo=, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@typescript-eslint/eslint-plugin/download/@typescript-eslint/eslint-plugin-5.1.0.tgz}
id: registry.npmmirror.com/@typescript-eslint/eslint-plugin/5.1.0
@ -5311,11 +5292,11 @@ packages:
name: '@vue/shared'
version: 3.2.20
registry.npmmirror.com/@vueuse/core/6.6.2_vue@3.2.20:
resolution: {integrity: sha1-8ZuFKFbhIShWyB5hp8XPNhjJK5Y=, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@vueuse/core/download/@vueuse/core-6.6.2.tgz}
id: registry.npmmirror.com/@vueuse/core/6.6.2
registry.npmmirror.com/@vueuse/core/6.7.3_vue@3.2.20:
resolution: {integrity: sha1-GoJ+475VqYyTL3FkZzN6CCbVSZM=, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@vueuse/core/download/@vueuse/core-6.7.3.tgz}
id: registry.npmmirror.com/@vueuse/core/6.7.3
name: '@vueuse/core'
version: 6.6.2
version: 6.7.3
peerDependencies:
'@vue/composition-api': ^1.1.0
vue: ^2.6.0 || ^3.2.0
@ -5325,16 +5306,16 @@ packages:
vue:
optional: true
dependencies:
'@vueuse/shared': registry.npmmirror.com/@vueuse/shared/6.6.2_vue@3.2.20
'@vueuse/shared': registry.npmmirror.com/@vueuse/shared/6.7.3_vue@3.2.20
vue: registry.npmmirror.com/vue/3.2.20
vue-demi: registry.nlark.com/vue-demi/0.11.4_vue@3.2.20
dev: false
registry.npmmirror.com/@vueuse/shared/6.6.2_vue@3.2.20:
resolution: {integrity: sha1-DMEPgRcv0010dt/X8XhMije+8Fs=, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@vueuse/shared/download/@vueuse/shared-6.6.2.tgz}
id: registry.npmmirror.com/@vueuse/shared/6.6.2
registry.npmmirror.com/@vueuse/shared/6.7.3_vue@3.2.20:
resolution: {integrity: sha1-ku1ps+eeGjCTb8Hx05oBB+jVIuA=, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@vueuse/shared/download/@vueuse/shared-6.7.3.tgz}
id: registry.npmmirror.com/@vueuse/shared/6.7.3
name: '@vueuse/shared'
version: 6.6.2
version: 6.7.3
peerDependencies:
'@vue/composition-api': ^1.1.0
vue: ^2.6.0 || ^3.2.0
@ -5858,12 +5839,20 @@ packages:
dev: true
registry.npmmirror.com/highlight.js/11.2.0:
resolution: {integrity: sha1-p+O4wf3E8FOLk7LcLd1TpAxqsPA=, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/highlight.js/download/highlight.js-11.2.0.tgz?cache=0&sync_timestamp=1634477593659&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fhighlight.js%2Fdownload%2Fhighlight.js-11.2.0.tgz}
resolution: {integrity: sha1-p+O4wf3E8FOLk7LcLd1TpAxqsPA=, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/highlight.js/download/highlight.js-11.2.0.tgz}
name: highlight.js
version: 11.2.0
engines: {node: '>=12.0.0'}
dev: false
registry.npmmirror.com/husky/7.0.4:
resolution: {integrity: sha1-JCBIJF3EnI+xvwzHz7mN1yJTFTU=, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/husky/download/husky-7.0.4.tgz?cache=0&sync_timestamp=1634783578168&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fhusky%2Fdownload%2Fhusky-7.0.4.tgz}
name: husky
version: 7.0.4
engines: {node: '>=12'}
hasBin: true
dev: true
registry.npmmirror.com/import-meta-resolve/1.1.1:
resolution: {integrity: sha1-JE/VQv0frnNVDU+LPN47uh17Kxg=, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/import-meta-resolve/download/import-meta-resolve-1.1.1.tgz}
name: import-meta-resolve
@ -5904,16 +5893,22 @@ packages:
dev: true
registry.npmmirror.com/jest-diff/26.6.2:
resolution: {integrity: sha1-GqdGi1LDpo19XF/c381eSb0WQ5Q=, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/jest-diff/download/jest-diff-26.6.2.tgz}
resolution: {integrity: sha1-GqdGi1LDpo19XF/c381eSb0WQ5Q=, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/jest-diff/download/jest-diff-26.6.2.tgz?cache=0&sync_timestamp=1634626979760&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fjest-diff%2Fdownload%2Fjest-diff-26.6.2.tgz}
name: jest-diff
version: 26.6.2
engines: {node: '>= 10.14.2'}
dependencies:
chalk: registry.nlark.com/chalk/4.1.2
diff-sequences: registry.nlark.com/diff-sequences/26.6.2
jest-get-type: registry.nlark.com/jest-get-type/26.3.0
jest-get-type: registry.npmmirror.com/jest-get-type/26.3.0
pretty-format: registry.npmmirror.com/pretty-format/26.6.2
registry.npmmirror.com/jest-get-type/26.3.0:
resolution: {integrity: sha1-6X3Dw/U8K0Bsp6+u1Ek7HQmRmeA=, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/jest-get-type/download/jest-get-type-26.3.0.tgz?cache=0&sync_timestamp=1634626960080&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fjest-get-type%2Fdownload%2Fjest-get-type-26.3.0.tgz}
name: jest-get-type
version: 26.3.0
engines: {node: '>= 10.14.2'}
registry.npmmirror.com/jiti/1.12.9:
resolution: {integrity: sha1-LORbJlz8jckevXClIEgHz5FSkbw=, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/jiti/download/jiti-1.12.9.tgz}
name: jiti
@ -6022,11 +6017,11 @@ packages:
version: 2.1.3
dev: true
registry.npmmirror.com/naive-ui/2.19.9_vue@3.2.20:
resolution: {integrity: sha1-+qyem185MB4OUrouUpRe1W3/SJA=, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/naive-ui/download/naive-ui-2.19.9.tgz}
id: registry.npmmirror.com/naive-ui/2.19.9
registry.npmmirror.com/naive-ui/2.19.11_vue@3.2.20:
resolution: {integrity: sha1-pl8Eey5T9ypJVbkYVvdusB41520=, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/naive-ui/download/naive-ui-2.19.11.tgz}
id: registry.npmmirror.com/naive-ui/2.19.11
name: naive-ui
version: 2.19.9
version: 2.19.11
peerDependencies:
vue: ^3.0.0
dependencies:
@ -6177,18 +6172,18 @@ packages:
dev: true
registry.npmmirror.com/pretty-format/26.6.2:
resolution: {integrity: sha1-41wnBfFMt/4v6U+geDRbREEg/JM=, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/pretty-format/download/pretty-format-26.6.2.tgz}
resolution: {integrity: sha1-41wnBfFMt/4v6U+geDRbREEg/JM=, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/pretty-format/download/pretty-format-26.6.2.tgz?cache=0&sync_timestamp=1634626978157&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fpretty-format%2Fdownload%2Fpretty-format-26.6.2.tgz}
name: pretty-format
version: 26.6.2
engines: {node: '>= 10'}
dependencies:
'@jest/types': registry.npmmirror.com/@jest/types/26.6.2
ansi-regex: registry.nlark.com/ansi-regex/5.0.0
ansi-regex: registry.nlark.com/ansi-regex/5.0.1
ansi-styles: registry.nlark.com/ansi-styles/4.3.0
react-is: registry.npmmirror.com/react-is/17.0.2
registry.npmmirror.com/react-is/17.0.2:
resolution: {integrity: sha1-5pHUqOnHiTZWVVOas3J2Kw77VPA=, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/react-is/download/react-is-17.0.2.tgz}
resolution: {integrity: sha1-5pHUqOnHiTZWVVOas3J2Kw77VPA=, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/react-is/download/react-is-17.0.2.tgz?cache=0&sync_timestamp=1634744017328&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Freact-is%2Fdownload%2Freact-is-17.0.2.tgz}
name: react-is
version: 17.0.2
@ -6251,7 +6246,7 @@ packages:
version: 6.0.0
engines: {node: '>=8'}
dependencies:
ansi-regex: registry.nlark.com/ansi-regex/5.0.0
ansi-regex: registry.nlark.com/ansi-regex/5.0.1
dev: true
registry.npmmirror.com/strip-ansi/6.0.1:

View File

@ -1,6 +1,8 @@
<template>
<n-layout-footer>
<div class="flex-center h-48px bg-white text-[#333639] dark:text-[#ffffffd1]">Copyright ©2021 Soybean Admin</div>
<div class="flex-center h-48px bg-light dark:bg-dark text-[#333639] dark:text-[#ffffffd1]">
Copyright ©2021 Soybean Admin
</div>
</n-layout-footer>
</template>

View File

@ -15,7 +15,7 @@
:icon="item.icon"
:active-route-name="activeParentRouteName"
:is-mini="app.menu.collapsed"
@click="handleMixMenu(item.routeName)"
@click="handleMixMenu(item.routeName, item.isSingle)"
/>
</n-scrollbar>
</div>
@ -34,7 +34,7 @@
import { ref, computed, watch } from 'vue';
import type { VNodeChild } from 'vue';
import { NScrollbar } from 'naive-ui';
import { useRoute } from 'vue-router';
import { useRouter, useRoute } from 'vue-router';
import { useAppStore, useThemeStore } from '@/store';
import { menus } from '@/router';
import { MixMenu, MixMenuCollapse, MixMenuDrawer } from './components';
@ -43,6 +43,7 @@ import { useBoolean } from '@/hooks';
const theme = useThemeStore();
const app = useAppStore();
const router = useRouter();
const route = useRoute();
const { bool: drawerVisible, setTrue: openDrawer, setFalse: hideDrawer } = useBoolean();
@ -53,10 +54,13 @@ const firstDegreeMenus = menus.map(item => {
const { routeName } = item;
const label = item.label as string;
const icon = item.icon! as () => VNodeChild;
const isSingle = !(item.children && item.children.length);
return {
routeName,
label,
icon
icon,
isSingle
};
});
@ -64,16 +68,20 @@ const activeParentRouteName = ref(getActiveRouteName());
function getActiveRouteName() {
let name = '';
const { matched } = route;
if (matched.length) {
name = matched[0].name as string;
const menuMatched = route.matched.filter(item => !item.meta.isNotMenu);
if (menuMatched.length) {
name = menuMatched[0].name as string;
}
return name;
}
function handleMixMenu(routeName: string) {
function handleMixMenu(routeName: string, isSingle: boolean) {
activeParentRouteName.value = routeName;
openDrawer();
if (isSingle) {
router.push({ name: routeName });
} else {
openDrawer();
}
}
function handleMouseLeaveMenu() {

View File

@ -1,9 +1,9 @@
<template>
<div class="p-6px">
<div class="flex justify-between h-360px">
<div class="flex-1 min-w-360px h-full bg-white rounded-16px"></div>
<div class="flex-1 min-w-360px h-full bg-white dark:bg-dark rounded-16px"></div>
<div class="w-16px"></div>
<div class="w-360px h-full bg-white rounded-16px"></div>
<div class="w-360px h-full bg-white dark:bg-dark rounded-16px"></div>
</div>
</div>
</template>