Compare commits

...

2 Commits

Author SHA1 Message Date
xiaogang 088f891271 提交测试 2024-06-07 14:37:14 +08:00
xiaogang 697c5df699 自定义打包脚本初步就位 2024-06-07 14:21:14 +08:00
3 changed files with 11 additions and 54 deletions

View File

@ -38,52 +38,6 @@
]
},
"pages": [
{
"path": "pages/coupon/index",
"type": "home",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "卡券页"
}
},
{
"path": "pages/about/about",
"type": "page",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "关于"
}
},
{
"path": "pages/activity/index",
"type": "page",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "活动页"
}
},
{
"path": "pages/coupon/order",
"type": "page",
"style": {
"navigationBarTitleText": "订单页"
}
},
{
"path": "pages/coupon/product",
"type": "page",
"style": {
"navigationBarTitleText": "产品页"
}
},
{
"path": "pages/index/index",
"type": "page",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "首页"
}
},
{
"path": "pages/login/index",
"type": "page",

View File

@ -4,13 +4,7 @@
// Generated by vite-plugin-uni-pages
interface NavigateToOptions {
url: "/pages/coupon/index" |
"/pages/about/about" |
"/pages/activity/index" |
"/pages/coupon/order" |
"/pages/coupon/product" |
"/pages/index/index" |
"/pages/login/index";
url: "/pages/login/index";
}
interface RedirectToOptions extends NavigateToOptions {}

View File

@ -17,6 +17,15 @@ import AutoImport from 'unplugin-auto-import/vite'
import { visualizer } from 'rollup-plugin-visualizer'
import ViteRestart from 'vite-plugin-restart'
import fs from 'fs'
const pages = fs.readdirSync('./src/pages')
const target = process.argv.slice(2)
const result = pages
.filter((dir) => {
return !target.includes(dir)
})
.map((ele) => `**/${ele}`)
// https://vitejs.dev/config/
export default ({ command, mode }) => {
// console.log(mode === process.env.NODE_ENV) // true
@ -50,7 +59,7 @@ export default ({ command, mode }) => {
plugins: [
UniPages({
exclude: ['**/components/**/**.*'],
exclude: ['**/components/**/**.*', ...result],
routeBlockLang: 'json5', // 虽然设了默认值但是vue文件还是要加上 lang="json5", 这样才能很好地格式化
// homePage 通过 vue 文件的 route-block 的type="home"来设定
// pages 目录为 src/pages分包目录不能配置在pages目录下