From f5cfc09936de009d7d68ab83d2cb2b1bffc0f77a Mon Sep 17 00:00:00 2001 From: eericxu <2681350846@qq.com> Date: Fri, 13 Oct 2023 17:35:07 +0800 Subject: [PATCH 1/4] feat: use hash router --- config/config.ts | 7 +++--- config/defaultSettings.ts | 2 ++ src/components/common/table.tsx | 9 ++++---- src/components/modal/EditorProductSystem.tsx | 6 ++--- src/components/modal/ViewBomInfoModal.tsx | 13 +++++------ src/components/routes/carbon/tags.tsx | 4 ++-- src/components/routes/chain.tsx | 23 ++++++++++---------- src/layout/_app.tsx | 19 ---------------- src/lib/utils.ts | 11 ++++++++-- 9 files changed, 41 insertions(+), 53 deletions(-) diff --git a/config/config.ts b/config/config.ts index 12bddb3..f03db87 100644 --- a/config/config.ts +++ b/config/config.ts @@ -1,6 +1,6 @@ // https://umijs.org/config/ import { defineConfig } from '@umijs/max'; -import defaultSettings, { DefTheme } from './defaultSettings'; +import defaultSettings, { DefTheme, historyType } from './defaultSettings'; import proxy from './proxy'; import routes from './routes'; @@ -8,6 +8,7 @@ const { REACT_APP_ENV = 'dev' } = process.env; export default defineConfig({ esbuildMinifyIIFE: true, + codeSplitting: { jsStrategy: 'granularChunks' }, /** * @name 开启 hash 模式 * @description 让 build 之后的产物包含 hash 后缀。通常用于增量发布和避免浏览器加载缓存。 @@ -18,8 +19,8 @@ export default defineConfig({ /** * @name 使用 Router */ - history: { type: 'browser' }, - exportStatic: {}, + history: { type: historyType }, + // exportStatic: {}, /** * @name 兼容性设置 * @description 设置 ie11 不一定完美兼容,需要检查自己使用的所有依赖 diff --git a/config/defaultSettings.ts b/config/defaultSettings.ts index 1cb6a53..7b12417 100644 --- a/config/defaultSettings.ts +++ b/config/defaultSettings.ts @@ -1,6 +1,8 @@ import { ProLayoutProps } from '@ant-design/pro-components'; import { ThemeConfig } from 'antd'; +export const historyType: 'hash' | 'browser' | 'memory' = 'hash'; + export const HEADER_HEIGHT = 56; export const DefTheme: ThemeConfig = { token: { diff --git a/src/components/common/table.tsx b/src/components/common/table.tsx index 25c2f74..a22498d 100644 --- a/src/components/common/table.tsx +++ b/src/components/common/table.tsx @@ -1,5 +1,6 @@ import { Loading } from '@/components/common/loading'; import { SIZE } from '@/components/const'; +import { Tooltip } from 'antd'; import classNames from 'classnames'; import { FC, useEffect, useRef, useState } from 'react'; import { FiChevronRight, FiFilter } from 'react-icons/fi'; @@ -132,11 +133,9 @@ export const Table: FC
{t('Platform powered by:')}
-
{t('Blockchain powered by:')}
-