diff --git a/config/config.ts b/config/config.ts index e07cfe5..25a7759 100644 --- a/config/config.ts +++ b/config/config.ts @@ -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', @@ -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'], // 指定不转换为视口单位的类,可以自定义,可以无限添加,建议定义一至两个通用的类名 @@ -64,6 +55,11 @@ export default defineConfig({ name: 'description', content: '基于umi@3.x + 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: { diff --git a/config/routes.ts b/config/routes.ts index adf3fbd..f2779a4 100644 --- a/config/routes.ts +++ b/config/routes.ts @@ -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', @@ -26,7 +26,7 @@ export default [ component: '@/pages/todo/index', }, { - path: '/tabBar/message', + path: '/tab-bar/message', title: '我的消息', icon: 'MessageOutline', badgeKey: 'messageBadge', @@ -37,7 +37,7 @@ export default [ component: '@/pages/message/index', }, { - path: '/tabBar/personalCenter', + path: '/tab-bar/personalCenter', title: '个人中心', icon: 'UserOutline', wrappers: [ diff --git a/package.json b/package.json index 210e8df..94da5b5 100644 --- a/package.json +++ b/package.json @@ -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" @@ -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",