Skip to content

Commit

Permalink
fix: 调整路由配置
Browse files Browse the repository at this point in the history
  • Loading branch information
hqwlkj committed Jun 20, 2024
1 parent f1a4303 commit f071956
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 29 deletions.
28 changes: 12 additions & 16 deletions config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,18 @@ export default defineConfig({
// dynamicImport: {
// loading: "@/pages/loading"
// },
routes: [...routes],
routes: routes,
// nodeModulesTransform: {
// type: "none"
// },
// antdMobile: {
// hd: true
// },
layout: false,
alias: {
// "antd-mobile": "antd-mobile/2x" //使用高清适配
},
// mfsu: { production: { output: ".mfsu-production" } },
fastRefresh: true,
extraBabelPlugins: [
[
'import',
{
libraryName: 'antd-mobile',
libraryDirectory: 'es/components',
style: false,
},
],
],
clickToComponent: {},
extraBabelPlugins: [],
autoprefixer: {
overrideBrowserslist: [
'Android 4.1',
Expand All @@ -44,10 +34,11 @@ export default defineConfig({
],
grid: true,
},
postcssLoader: {},
extraPostCSSPlugins: [
require('postcss-px-to-viewport')({
viewportWidth: 375, // 视口宽度,对应设计稿的宽度,一般是 375 或 750
viewportHeight: 667, // 视口高度,根据 750 设备的宽度来指定,一般指定 1334 也可以不配置
viewportWidth: 750, // 视口宽度,对应设计稿的宽度,一般是 375 或 750
viewportHeight: 1334, // 视口高度,根据 750 设备的宽度来指定,一般指定 1334 也可以不配置
unitPrecision: 3, // 指定 `px` 转换为视口单位值的小数位数
viewportUnit: 'vw', // 指定需要转换成的视口单位,建议使用 vw
selectorBlackList: ['.ignore', '.hairlines'], // 指定不转换为视口单位的类,可以自定义,可以无限添加,建议定义一至两个通用的类名
Expand All @@ -64,6 +55,11 @@ export default defineConfig({
name: 'description',
content: '基于[email protected] + antd-mobile@next 快速构建h5及app应用',
},
{
name: 'viewport',
content:
'width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no',
},
],
// https://mobile.ant.design/zh/guide/quick-start#%E5%85%BC%E5%AE%B9%E6%80%A7
targets: {
Expand Down
12 changes: 6 additions & 6 deletions config/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
* 更多路由请查询 https://umijs.org/zh-CN/docs/routing
*/
export default [
{ exact: true, path: '/', redirect: '/tabBar/index' },
{ path: '/', redirect: '/tab-bar/index' },
{
path: '/',
component: '@/layouts/index', // 采用umi 约定的全局路由, 因为umi不能针对不同的路由配置不同的 layout,所以需要在全局的layout中特殊处理。
layout: '@/layouts/index', // 采用umi 约定的全局路由, 因为umi不能针对不同的路由配置不同的 layout,所以需要在全局的layout中特殊处理。
routes: [
{
path: '/tabBar/index',
path: '/tab-bar/index',
title: '首页',
icon: 'AlipayCircleFill',
component: '@/pages/home/index',
},
{
path: '/tabBar/todo',
path: '/tab-bar/todo',
title: '我的待办',
badgeKey: 'todoBadge',
icon: 'UnorderedListOutline',
Expand All @@ -26,7 +26,7 @@ export default [
component: '@/pages/todo/index',
},
{
path: '/tabBar/message',
path: '/tab-bar/message',
title: '我的消息',
icon: 'MessageOutline',
badgeKey: 'messageBadge',
Expand All @@ -37,7 +37,7 @@ export default [
component: '@/pages/message/index',
},
{
path: '/tabBar/personalCenter',
path: '/tab-bar/personalCenter',
title: '个人中心',
icon: 'UserOutline',
wrappers: [
Expand Down
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
"prepare": "husky"
},
"gitHooks": {
"pre-commit": "lint-staged",
"commit-msg": "fabric verify-commit"
"pre-commit": "lint-staged"
},
"engines": {
"node": ">=10.0.0"
Expand All @@ -33,15 +32,15 @@
"@umijs/max": "^4.2.11",
"antd-mobile": "^5.36.1",
"antd-mobile-icons": "^0.3.0",
"react": "18.3.1",
"react-dom": "18.3.1"
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@types/mockjs": "^1.0.6",
"@types/react": "^18.2.11",
"@types/react-dom": "^18.2.4",
"@umijs/fabric": "^4.0.1",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@umijs/lint": "^4.2.11",
"@umijs/plugin-antd-mobile": "^1.2.0",
"@umijs/test": "^4.0.70",
"eslint": "^8.57.0",
"husky": "^9.0.11",
Expand Down

0 comments on commit f071956

Please sign in to comment.