From c985f45066bba35ba465b129854ae2b36e55bef8 Mon Sep 17 00:00:00 2001
From: yuanyxh <15766118362@139.com>
Date: Sat, 18 May 2024 09:35:44 +0800
Subject: [PATCH] fix: enter coder layout can not back
---
README.md | 2 +-
pnpm-lock.yaml | 25 ++++++++++++-------------
src/assets/svgs/typcn--arrow-back.svg | 1 +
src/coder/Wrapper.tsx | 14 ++++++++++++--
src/router/hooks/useHistory.ts | 12 +++++++++++-
vite.config.ts | 10 +++++-----
6 files changed, 42 insertions(+), 22 deletions(-)
create mode 100644 src/assets/svgs/typcn--arrow-back.svg
diff --git a/README.md b/README.md
index 0c4039c..1a84b19 100644
--- a/README.md
+++ b/README.md
@@ -32,7 +32,7 @@
- 微信:hxy3130gbs
- Email:yang_xuheng@163.com
-[博客站点]: https://yang-xianzhu.github.io/
+[博客站点]: https://blog-kappa-seven-43.vercel.app/
[Hexo]: https://hexo.io/zh-cn/
[Vuepress]: https://vuepress.vuejs.org/zh/
[项目]: https://github.com/yuanyxh/illustrate
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 8098ed7..2be5c4f 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -3388,17 +3388,17 @@ packages:
/@types/lodash-es@4.17.12:
resolution: {integrity: sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==}
dependencies:
- '@types/lodash': 4.17.1
+ '@types/lodash': 4.17.3
dev: true
/@types/lodash.debounce@4.0.9:
resolution: {integrity: sha512-Ma5JcgTREwpLRwMM+XwBR7DaWe96nC38uCBDFKZWbNKD+osjVzdpnUSwBcqCptrp16sSOLBAUb50Car5I0TCsQ==}
dependencies:
- '@types/lodash': 4.17.1
+ '@types/lodash': 4.17.3
dev: false
- /@types/lodash@4.17.1:
- resolution: {integrity: sha512-X+2qazGS3jxLAIz5JDXDzglAF3KpijdhFxlf/V1+hEsOUc+HnWi81L/uv/EvGuV90WY+7mPGFCUDGfQC3Gj95Q==}
+ /@types/lodash@4.17.3:
+ resolution: {integrity: sha512-zmNrEJaBvNskZXQWaUQq6bktF4IDGVfDS78M+YEk5aCn9M/b94/mB/6WCyfH2/MjwBdc6QuOor95CIlKWYRL3A==}
/@types/mapbox__rehype-prism@0.8.3:
resolution: {integrity: sha512-ayRTSAVHT0XpvKmx5GFN5luxwabuPb3EL06b3hRU0mnv30ETdcGmguk6C20R5EFVv6bWsfG8Jh6OUf+mMIqLdw==}
@@ -3862,7 +3862,7 @@ packages:
rc-slider: 10.6.2(react-dom@18.3.1)(react@18.3.1)
rc-steps: 6.0.1(react-dom@18.3.1)(react@18.3.1)
rc-switch: 4.1.0(react-dom@18.3.1)(react@18.3.1)
- rc-table: 7.45.6(react-dom@18.3.1)(react@18.3.1)
+ rc-table: 7.45.5(react-dom@18.3.1)(react@18.3.1)
rc-tabs: 15.0.0(react-dom@18.3.1)(react@18.3.1)
rc-textarea: 1.6.3(react-dom@18.3.1)(react@18.3.1)
rc-tooltip: 6.2.0(react-dom@18.3.1)(react@18.3.1)
@@ -4300,8 +4300,8 @@ packages:
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
hasBin: true
dependencies:
- caniuse-lite: 1.0.30001618
- electron-to-chromium: 1.4.769
+ caniuse-lite: 1.0.30001620
+ electron-to-chromium: 1.4.772
node-releases: 2.0.14
update-browserslist-db: 1.0.16(browserslist@4.23.0)
dev: true
@@ -4477,7 +4477,6 @@ packages:
peerDependencies:
devtools-protocol: '*'
dependencies:
- devtools-protocol: 0.0.1286932
devtools-protocol: 0.0.1286932
mitt: 3.0.1
urlpattern-polyfill: 10.0.0
@@ -5498,8 +5497,8 @@ packages:
jake: 10.9.1
dev: true
- /electron-to-chromium@1.4.769:
- resolution: {integrity: sha512-bZu7p623NEA2rHTc9K1vykl57ektSPQYFFqQir8BOYf6EKOB+yIsbFB9Kpm7Cgt6tsLr9sRkqfqSZUw7LP1XxQ==}
+ /electron-to-chromium@1.4.772:
+ resolution: {integrity: sha512-jFfEbxR/abTTJA3ci+2ok1NTuOBBtB4jH+UT6PUmRN+DY3WSD4FFRsgoVQ+QNIJ0T7wrXwzsWCI2WKC46b++2A==}
dev: true
/elkjs@0.9.3:
@@ -10226,7 +10225,7 @@ packages:
/puppeteer@1.20.0:
resolution: {integrity: sha512-bt48RDBy2eIwZPrkgbcwHtb51mj2nKvHOPMaSH2IsWiv7lOG9k9zhaRzpDZafrk05ajMc3cu+lSQYYOfH2DkVQ==}
engines: {node: '>=6.4.0'}
- deprecated: < 22.5.0 is no longer supported
+ deprecated: < 21.9.0 is no longer supported
requiresBuild: true
dependencies:
debug: 4.3.4
@@ -10706,8 +10705,8 @@ packages:
react-dom: 18.3.1(react@18.3.1)
dev: false
- /rc-table@7.45.6(react-dom@18.3.1)(react@18.3.1):
- resolution: {integrity: sha512-FYsTya3RQzLYct+o3fqHIZQIwrmsvrvhTg/I6hzlJZ1XoVAGoTmgkN1mMilVlYgksZTey9BCNYh94c6yhdjTXQ==}
+ /rc-table@7.45.5(react-dom@18.3.1)(react@18.3.1):
+ resolution: {integrity: sha512-R5sOfToOk7CalSkebZpqM8lkKWOJR7uXPGEhjjTSoj5egyHBwMxaACoPj2oI+6qLSll9yZrG5K+8HTN57b2Ahg==}
engines: {node: '>=8.x'}
peerDependencies:
react: '>=16.9.0'
diff --git a/src/assets/svgs/typcn--arrow-back.svg b/src/assets/svgs/typcn--arrow-back.svg
new file mode 100644
index 0000000..4fbf9f5
--- /dev/null
+++ b/src/assets/svgs/typcn--arrow-back.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/coder/Wrapper.tsx b/src/coder/Wrapper.tsx
index fc1cad2..e377eb4 100644
--- a/src/coder/Wrapper.tsx
+++ b/src/coder/Wrapper.tsx
@@ -159,14 +159,15 @@ type FieldType = {
};
export default function Wrapper() {
- const route = useRoutes();
+ const routes = useRoutes();
const location = useLocation();
+ const history = useHistory();
const [open, setOpen] = useState(false);
const [layoutId, setLayoutId] = useState(0);
const menu = useMemo(() => {
- const codes = route?.[1].children || [];
+ const codes = routes?.[1].children || [];
const curr = location.path.replace('/coder/', '').split('/').shift()!;
@@ -179,6 +180,10 @@ export default function Wrapper() {
setLayoutId(e);
};
+ const handleBack = () => {
+ history.back();
+ };
+
return (
@@ -222,6 +227,11 @@ export default function Wrapper() {
icon={}
onClick={() => setOpen(true)}
/>
+ }
+ onClick={handleBack}
+ />
);
diff --git a/src/router/hooks/useHistory.ts b/src/router/hooks/useHistory.ts
index 64c5182..dde2608 100644
--- a/src/router/hooks/useHistory.ts
+++ b/src/router/hooks/useHistory.ts
@@ -21,6 +21,14 @@ export function useHistory() {
);
}
+ function back() {
+ routerContext?.navigate(-1);
+ }
+
+ function forward() {
+ routerContext?.navigate(1);
+ }
+
function go(to: number) {
routerContext?.navigate(to);
}
@@ -28,7 +36,9 @@ export function useHistory() {
return {
push,
replace,
- go
+ go,
+ back,
+ forward
};
}, [routerContext]);
diff --git a/vite.config.ts b/vite.config.ts
index e8e89a9..f8810a6 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -19,7 +19,7 @@ import rehypePrism from '@mapbox/rehype-prism';
import viteRouteGenerator from './helpers/vite-route-generator';
import vitePrerender from './helpers/vite-prerender';
import viteGenerateSitemap from './helpers/vite-generate-sitemap';
-import basicSsl from '@vitejs/plugin-basic-ssl';
+// import basicSsl from '@vitejs/plugin-basic-ssl';
import type { ConfigEnv, UserConfig } from 'vite';
@@ -90,8 +90,8 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
iconDirs: [resolve('./src/assets/svgs')],
symbolId: 'icon-[dir]-[name]',
svgoOptions: true
- }),
- basicSsl()
+ })
+ // basicSsl()
],
resolve: {
alias: [
@@ -175,8 +175,8 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
changeOrigin: true,
rewrite: (path) => path.replace(/\/api/, 'issues')
}
- },
- https: {}
+ }
+ // https: {}
},
optimizeDeps: {
include: [],