Skip to content

Commit f687fe9

Browse files
committed
feat: 优化demo显示
1 parent d66dfdb commit f687fe9

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

pages.config.ts

-6
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ export default defineUniPages({
3737
pagePath: 'pages/demo/index',
3838
text: '示例',
3939
},
40-
{
41-
iconPath: 'static/tabbar/personal.png',
42-
selectedIconPath: 'static/tabbar/personalHL.png',
43-
pagePath: 'pages/my/index',
44-
text: '我的',
45-
},
4640
],
4741
},
4842
})

src/pages/demo/index.vue

+11-2
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,28 @@
1818
<script setup lang="ts" name="TestIndex">
1919
import pagesJson from '@/pages.json'
2020
21+
const handleTitle = (str?: string) => {
22+
if (!str) {
23+
return '标题'
24+
}
25+
if (/%.*%/.test(str)) {
26+
return '多语言'
27+
}
28+
return str
29+
}
2130
/** 基本功能 */
2231
const baseDemos = pagesJson.pages
2332
.filter((e) => e.path.startsWith('pages/demo/base'))
2433
.map((e) => ({
25-
title: e.style?.navigationBarTitleText || '默认页面标题',
34+
title: handleTitle(e.style?.navigationBarTitleText),
2635
path: e.path,
2736
}))
2837
2938
/** 页面功能 */
3039
const pageDemos = pagesJson.pages
3140
.filter((e) => e.path.startsWith('pages/demo/page'))
3241
.map((e) => ({
33-
title: e.style?.navigationBarTitleText || '默认页面标题',
42+
title: handleTitle(e.style?.navigationBarTitleText),
3443
path: e.path,
3544
}))
3645

vite.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export default ({ command, mode }) => {
4949
envDir: './env', // 自定义env目录
5050
plugins: [
5151
UniPages({
52-
exclude: ['**/components/**/**.*'],
52+
exclude: ['**/components/**/**.*', '**/my/**/**.vue'],
5353
routeBlockLang: 'json5', // 虽然设了默认值,但是vue文件还是要加上 lang="json5", 这样才能很好地格式化
5454
homePage: 'pages/index/index',
5555
subPackages: ['src/pages-sub'], // 是个数组,可以配置多个

0 commit comments

Comments
 (0)