From 1c0b6b2142650581e1391223ded954fcbff584a6 Mon Sep 17 00:00:00 2001 From: Burt <1020103647@qq.com> Date: Tue, 16 Jan 2024 10:24:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20add=20=E5=BE=AE=E4=BF=A1=E8=B0=83?= =?UTF-8?q?=E8=AF=95=20TODO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.config.ts | 4 +- src/pages.json | 155 ------------------------------------------------ vite.config.ts | 8 ++- 3 files changed, 7 insertions(+), 160 deletions(-) diff --git a/pages.config.ts b/pages.config.ts index 30c3004..d6a57e5 100644 --- a/pages.config.ts +++ b/pages.config.ts @@ -1,5 +1,5 @@ import { defineUniPages } from '@uni-helper/vite-plugin-uni-pages' -import { isWxProd } from './vite.config' +import { hideDemoPages } from './vite.config' export default defineUniPages({ globalStyle: { @@ -25,7 +25,7 @@ export default defineUniPages({ fontSize: '10px', iconWidth: '24px', spacing: '3px', - list: isWxProd + list: hideDemoPages ? [ { iconPath: 'static/tabbar/home.png', diff --git a/src/pages.json b/src/pages.json index 66a7baf..43b3ecc 100644 --- a/src/pages.json +++ b/src/pages.json @@ -29,12 +29,6 @@ "pagePath": "pages/index/index", "text": "首页" }, - { - "iconPath": "static/tabbar/example.png", - "selectedIconPath": "static/tabbar/exampleHL.png", - "pagePath": "pages/demo/index", - "text": "示例" - }, { "iconPath": "static/tabbar/personal.png", "selectedIconPath": "static/tabbar/personalHL.png", @@ -51,10 +45,6 @@ "navigationBarTitleText": "首页" } }, - { - "path": "pages/demo/index", - "type": "page" - }, { "path": "pages/login/index", "type": "page", @@ -68,151 +58,6 @@ "style": { "navigationBarTitleText": "我的" } - }, - { - "path": "pages/demo/demo/clock", - "type": "page", - "style": { - "navigationBarTitleText": "动态时钟" - } - }, - { - "path": "pages/demo/demo/component-auto-import", - "type": "page", - "style": { - "navigationBarTitleText": "easycom 自动导入" - } - }, - { - "path": "pages/demo/demo/lottery", - "type": "page", - "style": { - "navigationBarTitleText": "九宫格抽奖" - } - }, - { - "path": "pages/demo/demo/lottery2", - "type": "page", - "style": { - "navigationBarTitleText": "大转盘抽奖" - } - }, - { - "path": "pages/demo/demo/mp-weixin-share", - "type": "page", - "style": { - "navigationBarTitleText": "微信分享" - } - }, - { - "path": "pages/demo/demo/navbar", - "type": "page", - "style": { - "navigationBarTitleText": "自定义导航栏", - "navigationStyle": "custom" - } - }, - { - "path": "pages/demo/demo/pages-auto-import", - "type": "page", - "style": { - "navigationBarTitleText": "pages 自动导入" - } - }, - { - "path": "pages/demo/demo/pinia", - "type": "page", - "layout": "display", - "style": { - "navigationBarTitleText": "pinia+持久化" - } - }, - { - "path": "pages/demo/demo/request", - "type": "page", - "style": { - "navigationBarTitleText": "request请求+请求拦截" - } - }, - { - "path": "pages/demo/demo/throughout", - "type": "page", - "style": { - "navigationBarTitleText": "通屏+下拉刷新+自定义导航栏", - "enablePullDownRefresh": false, - "backgroundColor": "#23c09c", - "app-plus": { - "titleNView": { - "type": "transparent" - } - }, - "mp-weixin": { - "navigationStyle": "custom" - } - } - }, - { - "path": "pages/demo/demo/uni-ui-icons", - "type": "page", - "style": { - "navigationBarTitleText": "UniUI Icons 使用" - } - }, - { - "path": "pages/demo/demo/uni-ui", - "type": "page", - "style": { - "navigationBarTitleText": "UniUI 使用" - } - }, - { - "path": "pages/demo/demo/unocss-icons", - "type": "page", - "style": { - "navigationBarTitleText": "UnoCss Icons 使用" - } - }, - { - "path": "pages/demo/demo/unocss", - "type": "page", - "style": { - "navigationBarTitleText": "UnoCss 使用" - } - }, - { - "path": "pages/demo/demo/img-min/index", - "type": "page" - }, - { - "path": "pages/demo/demo/lottery/big-wheel", - "type": "page", - "style": { - "navigationBarTitleText": "大转盘抽奖" - } - }, - { - "path": "pages/demo/demo/lottery/nine-grid", - "type": "page", - "style": { - "navigationBarTitleText": "九宫格抽奖" - } - }, - { - "path": "pages/demo/demo/throughout/index", - "type": "page", - "style": { - "navigationBarTitleText": "通屏+下拉刷新+自定义导航栏", - "enablePullDownRefresh": true, - "backgroundColor": "#23c09c", - "app-plus": { - "titleNView": { - "type": "transparent" - } - }, - "mp-weixin": { - "navigationStyle": "custom" - } - } } ], "subPackages": [] diff --git a/vite.config.ts b/vite.config.ts index 8635ac7..db8d540 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -28,8 +28,10 @@ import { visualizer } from 'rollup-plugin-visualizer' // 另外,小程序有主包2M的限制,所以一般图片会放到图片服务器(不放本地),那这个插件就没用,所以在开发h5的时候,使用本地图片才用得到,既然如此那就不装吧 // import viteImagemin from 'vite-plugin-imagemin' -export const isWxProd = - process.env.UNI_PLATFORM === 'mp-weixin' && process.env.NODE_ENV === 'production' +// 微信生产环境、本地真机调试不要demo路由,本地开发可以有;TODO: 下面2个根据使用条件选一个即可 +export const hideDemoPages = process.env.UNI_PLATFORM === 'mp-weixin' +// export const hideDemoPages = +// process.env.UNI_PLATFORM === 'mp-weixin' && process.env.NODE_ENV === 'production' // https://vitejs.dev/config/ export default ({ command, mode }) => { @@ -53,7 +55,7 @@ export default ({ command, mode }) => { plugins: [ UniPages({ // TODO: 生产环境小程序要过滤掉demo(demo里面很多图片,超过2M的包大小) - exclude: isWxProd + exclude: hideDemoPages ? ['**/components/**/**.*', '**/demo/**/**.*'] : ['**/components/**/**.*'], }),