Skip to content

Commit e68405b

Browse files
committed
refactor(oss-licenses):优化版本号显示逻辑
- 在 oss-licenses 和 oss-licenses-menu 页面中添加 utils 模块引用 - 使用 utils.formatVersion 函数格式化版本号显示 - 新增 util.wxs 文件,实现 formatVersion 函数
1 parent 1006db5 commit e68405b

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

source/pages/oss-licenses-menu/oss-licenses-menu.wxml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
1212
See the Mulan PubL v2 for more details.
1313
-->
1414

15+
<wxs module="utils" src="../../utils/util.wxs"></wxs>
16+
1517
<view id="titleTop1">
1618
<t-navbar left-arrow t-class-content="t-navbar-content" t-class-placeholder="t-navbar-placeholder">
1719
<view class="ml-16rpx text-36rpx font-600" slot="left">开放源代码许可</view>
@@ -25,7 +27,7 @@ See the Mulan PubL v2 for more details.
2527
<view slot="title">
2628
<text class="text-32rpx inline">{{item.name + (item.publisher !== '' ? (' (' + item.publisher + ')') : '')}}</text>
2729
<t-tag class="ml-16rpx inline-block vertical-bottom" size="small" theme="default" variant="light">
28-
{{'v' + item.version}}
30+
{{utils.formatVersion(item.version)}}
2931
</t-tag>
3032
</view>
3133
<t-tag class="mt-12rpx" size="medium" slot="description" theme="primary" variant="light">

source/pages/oss-licenses/oss-licenses.wxml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
1212
See the Mulan PubL v2 for more details.
1313
-->
1414

15+
<wxs module="utils" src="../../utils/util.wxs"></wxs>
16+
1517
<t-message id="t-message"/>
1618

1719
<view id="titleTop1">
1820
<t-navbar left-arrow t-class-content="t-navbar-content" t-class-placeholder="t-navbar-placeholder">
1921
<view class="ml-16rpx" slot="left">
2022
<view class=" text-36rpx font-600 inline">{{title}}</view>
2123
<t-tag class="ml-16rpx inline-block vertical-bottom" size="small" theme="default" variant="light">
22-
{{'v' + version}}
24+
{{utils.formatVersion(version)}}
2325
</t-tag>
2426
</view>
2527
</t-navbar>

source/utils/util.wxs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
Copyright (c) 2024 ArcticFoxPro
3+
Qverbow Vigor is licensed under Mulan PubL v2.
4+
You can use this software according to the terms and conditions of the Mulan PubL v2.
5+
You may obtain a copy of Mulan PubL v2 at:
6+
http://license.coscl.org.cn/MulanPubL-2.0
7+
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+
See the Mulan PubL v2 for more details.
11+
*/
12+
13+
module.exports = {
14+
formatVersion: function(version) {
15+
return '1234567890'.indexOf(version[0]) !== -1 ? 'v' + version : version;
16+
}
17+
};

0 commit comments

Comments
 (0)