uview-pro 0.4.2 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/changelog.md CHANGED
@@ -1,19 +1,51 @@
1
- ## 0.4.2(2025-12-01
1
+ ## 0.4.4(2025-12-08
2
2
 
3
- ### 📝 Documentation | 文档
3
+ ### Features | 新功能
4
4
 
5
- - **scripts:** 更新发布指定版本说明文档 ([db6bfe8](https://github.com/anyup/uView-Pro/commit/db6bfe8a7ec2812f34738b5b707240cdfe57e8b3))
5
+ - **u-card:** u-card 组件的默认插槽同 body 插槽 ([ffa13ed](https://github.com/anyup/uView-Pro/commit/ffa13edcf17ff1559e8bdf2260f6b146680f9d07))
6
+ - **u-tag:** 优化自定义样式 custom-style 应用,支持 text 插槽内容 ([5bdb733](https://github.com/anyup/uView-Pro/commit/5bdb73346252850d74165cda0bb00766e5f6f59f))
7
+ - **u-line-progress:** 优化u-line-progress进度条百分比显示方式 ([1c1d979](https://github.com/anyup/uView-Pro/commit/1c1d97958f3c7e5a28943b46ea25d38b50449364))
8
+ - **switch:** 增强开关组件支持自定义值类型 ([2bcb136](https://github.com/anyup/uView-Pro/commit/2bcb1368aa1f3c7fe83799e909b89fc4349b30c3))
6
9
 
7
- ### 🐛 Bug Fixes | Bug 修复
10
+ ### 📝 Documentation | 文档
8
11
 
9
- - **theme:** 修复npm方式加载主题包失效的问题 ([7b9c947](https://github.com/anyup/uView-Pro/commit/7b9c947581697ddbd36632919652689ca8595503))
10
- - **dark-mode:** 修复 App 平台暗黑模式跟随系统下,切换系统暗黑模式后不即时生效问题 ([880b181](https://github.com/anyup/uView-Pro/commit/880b18153d186f6f5c5f9c81bf12307bd8f00c22))
11
- - **initTheme:** 优化组件库 install 方法中的主题初始化默认逻辑 ([39e273b](https://github.com/anyup/uView-Pro/commit/39e273b98cd53ec2891c7e68419dd6dfbbeb30c0))
12
+ - 优化 Markdown 文档样式和格式 ([c80ff6d](https://github.com/anyup/uView-Pro/commit/c80ff6df269eb92a88001373aa96344ff4cafb79))
12
13
 
13
14
  ### 👥 Contributors
14
15
 
15
- <a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
16
+ <a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a> <a href="https://github.com/liujiayii"><img src="https://github.com/liujiayii.png?size=40" width="40" height="40" alt="liujiayii" title="liujiayii"/></a>
16
17
 
18
+ ## 0.4.3(2025-12-03)
19
+
20
+ ### 📝 Documentation | 文档
21
+
22
+ - 更新项目描述和移除冗余信息 ([3d5c105](https://github.com/anyup/uView-Pro/commit/3d5c1053873a1a1dc592e02caf62b5e5f9aba3ad))
23
+ - **readme:** 更新交流反馈和捐赠链接 ([266e788](https://github.com/anyup/uView-Pro/commit/266e7883a4e2f3ea8058e0bba0b7ce07a972bad8))
24
+
25
+ ### 🐛 Bug Fixes | Bug 修复
26
+
27
+ - **theme:** 修复不使用 u-config-privider 全局注入时,部分颜色变量不存在的问题 ([cd82d9d](https://github.com/anyup/uView-Pro/commit/cd82d9da3e8fd6066177e3b78b855583e2756a5f))
28
+
29
+ ### 👥 Contributors
30
+
31
+ <a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
32
+
33
+ ## 0.4.2(2025-12-01)
34
+
35
+ ### 📝 Documentation | 文档
36
+
37
+ - **scripts:** 更新发布指定版本说明文档 ([db6bfe8](https://github.com/anyup/uView-Pro/commit/db6bfe8a7ec2812f34738b5b707240cdfe57e8b3))
38
+
39
+ ### 🐛 Bug Fixes | Bug 修复
40
+
41
+ - **theme:** 修复npm方式加载主题包失效的问题 ([7b9c947](https://github.com/anyup/uView-Pro/commit/7b9c947581697ddbd36632919652689ca8595503))
42
+ - **dark-mode:** 修复 App 平台暗黑模式跟随系统下,切换系统暗黑模式后不即时生效问题 ([880b181](https://github.com/anyup/uView-Pro/commit/880b18153d186f6f5c5f9c81bf12307bd8f00c22))
43
+ - **initTheme:** 优化组件库 install 方法中的主题初始化默认逻辑 ([39e273b](https://github.com/anyup/uView-Pro/commit/39e273b98cd53ec2891c7e68419dd6dfbbeb30c0))
44
+
45
+ ### 👥 Contributors
46
+
47
+ <a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
48
+
17
49
  ## 0.4.1(2025-11-30)
18
50
 
19
51
  ### ✨ Features | 新功能
@@ -61,6 +61,7 @@
61
61
  <slot name="head" v-else />
62
62
  </view>
63
63
  <view @tap="onBodyClick" class="u-card__body" :style="[{ padding: padding + 'rpx' }, bodyStyle]">
64
+ <slot />
64
65
  <slot name="body" />
65
66
  </view>
66
67
  <view
@@ -17,9 +17,9 @@
17
17
  :style="progressStyle"
18
18
  >
19
19
  <slot v-if="slots.default" />
20
- <template v-else-if="showPercent">
20
+ <text class="u-progress-text" v-else-if="showPercent">
21
21
  {{ percent + '%' }}
22
- </template>
22
+ </text>
23
23
  </view>
24
24
  </view>
25
25
  </template>
@@ -114,6 +114,11 @@ const progressStyle = computed(() => {
114
114
  animation: progress-stripes 2s linear infinite;
115
115
  }
116
116
 
117
+ .u-progress-text {
118
+ color: var(--u-light-color);
119
+ padding: 0 10rpx;
120
+ }
121
+
117
122
  @keyframes progress-stripes {
118
123
  0% {
119
124
  background-position: 0 0;
@@ -18,8 +18,8 @@ export const SwitchProps = {
18
18
  activeColor: { type: String, default: () => getColor('primary') },
19
19
  /** 关闭时的颜色 */
20
20
  inactiveColor: { type: String, default: 'var(--u-white-color)' },
21
- /** v-model 绑定值,是否选中 */
22
- modelValue: { type: Boolean, default: false },
21
+ /** v-model 绑定值,开关状态值 */
22
+ modelValue: { type: [Number, String, Boolean] as PropType<number | string | boolean>, default: false },
23
23
  /** 是否开启轻微震动反馈 */
24
24
  vibrateShort: { type: Boolean, default: false },
25
25
  /** 打开时的值 */
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <view
3
3
  class="u-switch"
4
- :class="[modelValue == true ? 'u-switch--on' : '', disabled ? 'u-switch--disabled' : '', customClass]"
4
+ :class="[isChecked ? 'u-switch--on' : '', disabled ? 'u-switch--disabled' : '', customClass]"
5
5
  @tap="onClick"
6
6
  :style="$u.toStyle(switchStyle, customStyle)"
7
7
  >
@@ -53,20 +53,28 @@ const props = defineProps(SwitchProps);
53
53
 
54
54
  const emit = defineEmits(['update:modelValue', 'change']);
55
55
 
56
+ /**
57
+ * 计算属性:是否处于激活状态
58
+ * 通过比较modelValue和activeValue来确定开关的真实状态
59
+ */
60
+ const isChecked = computed(() => {
61
+ return props.modelValue === props.activeValue;
62
+ });
63
+
56
64
  /**
57
65
  * 计算开关样式
58
66
  */
59
67
  const switchStyle = computed(() => {
60
68
  let style: Record<string, string> = {};
61
69
  style.fontSize = props.size + 'rpx';
62
- style.backgroundColor = props.modelValue ? props.activeColor : props.inactiveColor;
70
+ style.backgroundColor = isChecked.value ? props.activeColor : props.inactiveColor;
63
71
  return style;
64
72
  });
65
73
  /**
66
74
  * 计算加载动画颜色
67
75
  */
68
76
  const loadingColor = computed(() => {
69
- return props.modelValue ? props.activeColor : null;
77
+ return isChecked.value ? props.activeColor : null;
70
78
  });
71
79
 
72
80
  /**
@@ -76,10 +84,13 @@ function onClick() {
76
84
  if (!props.disabled && !props.loading) {
77
85
  // 使手机产生短促震动,微信小程序有效,APP(HX 2.6.8)和H5无效
78
86
  if (props.vibrateShort) uni.vibrateShort();
79
- emit('update:modelValue', !props.modelValue);
87
+
88
+ // 根据当前状态切换到另一个值
89
+ const newValue = isChecked.value ? props.inactiveValue : props.activeValue;
90
+ emit('update:modelValue', newValue);
80
91
  // 放到下一个生命周期,因为双向绑定的value修改父组件状态需要时间,且是异步的
81
92
  nextTick(() => {
82
- emit('change', props.modelValue ? props.activeValue : props.inactiveValue);
93
+ emit('change', newValue);
83
94
  });
84
95
  }
85
96
  }
@@ -113,11 +124,6 @@ function onClick() {
113
124
  border-radius: 100%;
114
125
  z-index: 1;
115
126
  background-color: var(--u-bg-white);
116
- background-color: var(--u-bg-white);
117
- box-shadow:
118
- 0 3px 1px 0 rgba(0, 0, 0, 0.05),
119
- 0 2px 2px 0 rgba(0, 0, 0, 0.1),
120
- 0 3px 3px 0 rgba(0, 0, 0, 0.05);
121
127
  box-shadow:
122
128
  0 3px 1px 0 rgba(0, 0, 0, 0.05),
123
129
  0 2px 2px 0 rgba(0, 0, 0, 0.1),
@@ -9,10 +9,12 @@
9
9
  customClass
10
10
  ]"
11
11
  class="u-tag"
12
- :style="$u.toStyle(customStyle)"
12
+ :style="$u.toStyle(tagStyle, customStyle)"
13
13
  @tap="clickTag"
14
14
  >
15
- {{ text }}
15
+ <slot>
16
+ {{ text }}
17
+ </slot>
16
18
  <view class="u-icon-wrap" @tap.stop>
17
19
  <u-icon
18
20
  @click="close"
@@ -75,7 +77,7 @@ const props = defineProps(TagProps);
75
77
  /**
76
78
  * 计算 tag 的自定义样式
77
79
  */
78
- const customStyle = computed(() => {
80
+ const tagStyle = computed(() => {
79
81
  let style: Record<string, any> = {};
80
82
  // 文字颜色(如果有此值,会覆盖type值的颜色)
81
83
  if (props.color) style.color = props.color;
package/package.json CHANGED
@@ -2,8 +2,8 @@
2
2
  "id": "uview-pro",
3
3
  "name": "uview-pro",
4
4
  "displayName": "【支持鸿蒙】uView Pro|基于Vue3+TS的80+精选UI组件库,支持多主题,暗黑模式",
5
- "version": "0.4.2",
6
- "description": "uView Pro,是全面支持Vue3的uni-app生态框架,80+精选组件已全面使用TypeScript重构,智能多主题配置,一键暗黑模式",
5
+ "version": "0.4.4",
6
+ "description": "uView Pro,是全面支持Vue3+TS的uni-app生态框架,80+精选组件,支持安卓,iOS,鸿蒙,各小程序平台,支持多主题,一键暗黑模式",
7
7
  "main": "index.ts",
8
8
  "module": "index.ts",
9
9
  "browser": "index.ts",
package/readme.md CHANGED
@@ -67,20 +67,15 @@ pnpm dev
67
67
 
68
68
  ## 交流反馈
69
69
 
70
- `uView Pro` 微信交流群: [点击进入](https://uviewpro.cn/zh/resource/about.html)
70
+ 欢迎通过各种方式来交流反馈,让 uView Pro 更好的为大家服务:
71
71
 
72
- `uView Pro` QQ 交流群: [点击进入](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=98nSVDldWEbDdq4lxiP4aL7uATfMSlI6&authKey=G2yQJ5MQiKzMldaxBsIfKt17NuJuUw8Fr6zdKLggc6NZXgw4BVbqkU2U3EE994yd&noverify=0&group_code=811732166)
72
+ [欢迎交流反馈](https://uviewpro.cn/zh/resource/about.html)
73
73
 
74
- <table class="table">
75
- <tr>
76
- <td><img src="https://ik.imagekit.io/anyup/images/social/weixin-chat-cl.png" width="250" height="345" ></td>
77
- <td><img src="https://ik.imagekit.io/anyup/images/social/qq-chat.png" width="250" height="345" ></td>
78
- </tr>
79
- <tr>
80
- <td align="center"><strong>微信群</strong><br></td>
81
- <td align="center"><strong>QQ群</strong><br></td>
82
- </tr>
83
- </table>
74
+ ## 捐赠 uView Pro
75
+
76
+ 开源不易,如果您认为 `uView Pro` 帮到了您的开发工作,您可以捐赠 `uView Pro`:
77
+
78
+ [欢迎捐赠留名](https://uviewpro.cn/zh/resource/donation.html)
84
79
 
85
80
  ## 关于 PR
86
81
 
@@ -206,21 +201,6 @@ export function createApp() {
206
201
 
207
202
  请通过[快速上手](https://uviewpro.cn/zh/components/quickstart.html)了解更详细的内容
208
203
 
209
- ## 捐赠 uView Pro
210
-
211
- `uView Pro` 文档内容和框架源码基于 `uView UI` 二次开发,因此全部开源免费,如果您认为 `uView Pro` 帮到了您的开发工作,您可以捐赠 `uView Pro` 的研发工作,捐赠无门槛,哪怕是一杯可乐也好(相信这比打赏主播更有意义)。
212
-
213
- <table class="table">
214
- <tr>
215
- <td><img src="https://ik.imagekit.io/anyup/images/social/wechat-pay.png" width="250" height="345" ></td>
216
- <td><img src="https://ik.imagekit.io/anyup/images/social/ali-pay.png" width="250" height="345" ></td>
217
- </tr>
218
- <tr>
219
- <td align="center"><strong>微信</strong><br></td>
220
- <td align="center"><strong>支付宝</strong><br></td>
221
- </tr>
222
- </table>
223
-
224
204
  ## 贡献者
225
205
 
226
206
  <a href="https://github.com/anyup/uView-Pro/graphs/contributors">
package/theme.scss CHANGED
@@ -2,53 +2,115 @@
2
2
  // uni.scss中引入的样式会同时混入到全局样式文件和单独每一个页面的样式中,造成微信程序包太大,
3
3
  // 故uni.scss只建议放scss变量名相关样式,其他的样式可以通过main.js或者App.vue引入
4
4
 
5
- // 常用色
6
- $u-main-color: var(--u-main-color, #303133);
7
- $u-content-color: var(--u-content-color, #606266);
8
- $u-tips-color: var(--u-tips-color, #909399);
9
- $u-light-color: var(--u-light-color, #c0c4cc);
10
- $u-border-color: var(--u-border-color, #e4e7ed);
11
- $u-divider-color: var(--u-divider-color, #e4e7ed);
12
- $u-mask-color: var(--u-mask-color, rgba(0, 0, 0, 0.4));
13
- $u-shadow-color: var(--u-shadow-color, rgba(0, 0, 0, 0.1));
5
+ :root,
6
+ page {
7
+ /* 纯色 */
8
+ --u-white-color: #ffffff;
9
+ --u-black-color: #000000;
10
+
11
+ // 字体色
12
+ --u-main-color: #303133;
13
+ --u-content-color: #606266;
14
+ --u-tips-color: #909399;
15
+ --u-light-color: #c0c4cc;
16
+
17
+ // 边框色
18
+ --u-border-color: #e4e7ed;
19
+ --u-divider-color: #e4e7ed;
20
+
21
+ // 遮罩色
22
+ --u-mask-color: rgba(0, 0, 0, 0.4);
23
+ --u-shadow-color: rgba(0, 0, 0, 0.1);
24
+
25
+ /* 背景色 */
26
+ --u-bg-color: #f3f4f6;
27
+ --u-bg-white: #ffffff;
28
+ --u-bg-gray-light: #f5f7fa;
29
+ --u-bg-gray-dark: #2f343c;
30
+ --u-bg-black: #000000;
31
+
32
+ /* 主色 */
33
+ --u-type-primary: #2979ff;
34
+ --u-type-primary-light: #ecf5ff;
35
+ --u-type-primary-disabled: #a0cfff;
36
+ --u-type-primary-dark: #2b85e4;
37
+
38
+ /* 警告色 */
39
+ --u-type-warning: #ff9900;
40
+ --u-type-warning-disabled: #fcbd71;
41
+ --u-type-warning-dark: #f29100;
42
+ --u-type-warning-light: #fdf6ec;
43
+
44
+ /* 成功色 */
45
+ --u-type-success: #19be6b;
46
+ --u-type-success-disabled: #71d5a1;
47
+ --u-type-success-dark: #18b566;
48
+ --u-type-success-light: #dbf1e1;
49
+
50
+ /* 错误色 */
51
+ --u-type-error: #fa3534;
52
+ --u-type-error-disabled: #fab6b6;
53
+ --u-type-error-dark: #dd6161;
54
+ --u-type-error-light: #fef0f0;
55
+
56
+ /* 信息色 */
57
+ --u-type-info: #909399;
58
+ --u-type-info-disabled: #c8c9cc;
59
+ --u-type-info-dark: #82848a;
60
+ --u-type-info-light: #f4f4f5;
61
+ }
14
62
 
15
63
  // 纯色
16
- $u-white-color: var(--u-white-color, #ffffff);
17
- $u-black-color: var(--u-black-color, #000000);
64
+ $u-white-color: var(--u-white-color);
65
+ $u-black-color: var(--u-black-color);
66
+
67
+ // 字体色
68
+ $u-main-color: var(--u-main-color);
69
+ $u-content-color: var(--u-content-color);
70
+ $u-tips-color: var(--u-tips-color);
71
+ $u-light-color: var(--u-light-color);
72
+
73
+ // 边框色
74
+ $u-border-color: var(--u-border-color);
75
+ $u-divider-color: var(--u-divider-color);
76
+
77
+ // 遮罩色
78
+ $u-mask-color: var(--u-mask-color);
79
+ $u-shadow-color: var(--u-shadow-color);
18
80
 
19
81
  // 背景色
20
- $u-bg-color: var(--u-bg-color, #f3f4f6);
21
- $u-bg-white: var(--u-bg-white, #ffffff);
22
- $u-bg-gray-light: var(--u-bg-gray-light, #f5f7fa);
23
- $u-bg-gray-dark: var(--u-bg-gray-dark, #2f343c);
24
- $u-bg-black: var(--u-bg-black, #000000);
82
+ $u-bg-color: var(--u-bg-color);
83
+ $u-bg-white: var(--u-bg-white);
84
+ $u-bg-gray-light: var(--u-bg-gray-light);
85
+ $u-bg-gray-dark: var(--u-bg-gray-dark);
86
+ $u-bg-black: var(--u-bg-black);
25
87
 
26
88
  // 主色
27
- $u-type-primary: var(--u-type-primary, #2979ff);
28
- $u-type-primary-light: var(--u-type-primary-light, #ecf5ff);
29
- $u-type-primary-disabled: var(--u-type-primary-disabled, #a0cfff);
30
- $u-type-primary-dark: var(--u-type-primary-dark, #2b85e4);
89
+ $u-type-primary: var(--u-type-primary);
90
+ $u-type-primary-light: var(--u-type-primary-light);
91
+ $u-type-primary-disabled: var(--u-type-primary-disabled);
92
+ $u-type-primary-dark: var(--u-type-primary-dark);
31
93
 
32
94
  // 警告色
33
- $u-type-warning: var(--u-type-warning, #ff9900);
34
- $u-type-warning-disabled: var(--u-type-warning-disabled, #fcbd71);
35
- $u-type-warning-dark: var(--u-type-warning-dark, #f29100);
36
- $u-type-warning-light: var(--u-type-warning-light, #fdf6ec);
95
+ $u-type-warning: var(--u-type-warning);
96
+ $u-type-warning-disabled: var(--u-type-warning-disabled);
97
+ $u-type-warning-dark: var(--u-type-warning-dark);
98
+ $u-type-warning-light: var(--u-type-warning-light);
37
99
 
38
100
  // 成功色
39
- $u-type-success: var(--u-type-success, #19be6b);
40
- $u-type-success-disabled: var(--u-type-success-disabled, #71d5a1);
41
- $u-type-success-dark: var(--u-type-success-dark, #18b566);
42
- $u-type-success-light: var(--u-type-success-light, #dbf1e1);
101
+ $u-type-success: var(--u-type-success);
102
+ $u-type-success-disabled: var(--u-type-success-disabled);
103
+ $u-type-success-dark: var(--u-type-success-dark);
104
+ $u-type-success-light: var(--u-type-success-light);
43
105
 
44
106
  // 错误色
45
- $u-type-error: var(--u-type-error, #fa3534);
46
- $u-type-error-disabled: var(--u-type-error-disabled, #fab6b6);
47
- $u-type-error-dark: var(--u-type-error-dark, #dd6161);
48
- $u-type-error-light: var(--u-type-error-light, #fef0f0);
107
+ $u-type-error: var(--u-type-error);
108
+ $u-type-error-disabled: var(--u-type-error-disabled);
109
+ $u-type-error-dark: var(--u-type-error-dark);
110
+ $u-type-error-light: var(--u-type-error-light);
49
111
 
50
112
  // 信息色
51
- $u-type-info: var(--u-type-info, #909399);
52
- $u-type-info-disabled: var(--u-type-info-disabled, #c8c9cc);
53
- $u-type-info-dark: var(--u-type-info-dark, #82848a);
54
- $u-type-info-light: var(--u-type-info-light, #f4f4f5);
113
+ $u-type-info: var(--u-type-info);
114
+ $u-type-info-disabled: var(--u-type-info-disabled);
115
+ $u-type-info-dark: var(--u-type-info-dark);
116
+ $u-type-info-light: var(--u-type-info-light);