feat: add 微信调试 TODO

This commit is contained in:
Burt 2024-01-16 10:24:29 +08:00
parent 26068635dc
commit 1c0b6b2142
3 changed files with 7 additions and 160 deletions

View File

@ -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',

View File

@ -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": []

View File

@ -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: 生产环境小程序要过滤掉demodemo里面很多图片超过2M的包大小
exclude: isWxProd
exclude: hideDemoPages
? ['**/components/**/**.*', '**/demo/**/**.*']
: ['**/components/**/**.*'],
}),