uview-pro 0.5.6 → 0.5.7

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,13 +1,30 @@
1
- ## 0.5.6(2026-02-04
1
+ ## 0.5.7(2026-02-06
2
2
 
3
3
  ### 🐛 Bug Fixes | Bug 修复
4
4
 
5
- - **vue-tsc:** 修复部分定时器ts类型定义错误问题(#124) ([dada764](https://github.com/anyup/uView-Pro/commit/dada764eaa6ea73402e8fa6d96a783ae2a68715a))
5
+ - **u-tabs:** 修复u-tabs的scroll-view在不同平台会显示滚动条的问题,统一各平台的滚动条隐藏逻辑 ([6ba904b](https://github.com/anyup/uView-Pro/commit/6ba904b85fdc5be69ab8b430878e16fa74674c64))
6
+ - **demo:** 修复演示项目在钉钉小程序调用uni.setTabBarItem报错问题(#125) ([fd4ea39](https://github.com/anyup/uView-Pro/commit/fd4ea3987928039e9dcc3a53dc8bea42fce2b685))
7
+ - **u-input,u-field:** 修复输入框绑定值为undefined和null时的显示异常问题 ([4af659f](https://github.com/anyup/uView-Pro/commit/4af659fb365179e3ed7db26a1d8571c327497f7a))
8
+
9
+ ### ✨ Features | 新功能
10
+
11
+ - **demo-page:** 所有页面支持小程序分享功能 ([a055904](https://github.com/anyup/uView-Pro/commit/a05590443e898ed076d47a04cb8bfc74c2e73da8))
12
+ - **u-card:** u-card添加圆角配置功能并调整默认边框样式 ([e43c939](https://github.com/anyup/uView-Pro/commit/e43c9396a17fe485305e63895a7ea8d6edf1906b))
6
13
 
7
14
  ### 👥 Contributors
8
15
 
9
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>
10
17
 
18
+ ## 0.5.6(2026-02-04)
19
+
20
+ ### 🐛 Bug Fixes | Bug 修复
21
+
22
+ - **vue-tsc:** 修复部分定时器ts类型定义错误问题(#124) ([dada764](https://github.com/anyup/uView-Pro/commit/dada764eaa6ea73402e8fa6d96a783ae2a68715a))
23
+
24
+ ### 👥 Contributors
25
+
26
+ <a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
27
+
11
28
  ## 0.5.5(2026-02-02)
12
29
 
13
30
  ### ✨ Features | 新功能
@@ -25,7 +25,7 @@ export const CardProps = {
25
25
  /** 副标题字体大小,单位rpx */
26
26
  subTitleSize: { type: [Number, String], default: '26' },
27
27
  /** 是否显示外部边框,只对full=false时有效(卡片与边框有空隙时) */
28
- border: { type: Boolean, default: true },
28
+ border: { type: Boolean, default: false },
29
29
  /** 用于标识点击了第几个 */
30
30
  index: { type: [String, Number, Object] as PropType<CardIndex>, default: '' },
31
31
  /** 用于隔开上下左右的边距,带单位的写法,如:"30rpx 30rpx","20rpx 20rpx 30rpx 30rpx" */
@@ -36,7 +36,7 @@
36
36
  v-if="props.type === 'textarea'"
37
37
  class="u-flex-1 u-textarea-class"
38
38
  :style="$u.toStyle(props.fieldStyle)"
39
- :value="String(props.modelValue)"
39
+ :value="inputValue"
40
40
  :placeholder="String(props.placeholder)"
41
41
  :placeholderStyle="props.placeholderStyle"
42
42
  :disabled="props.disabled"
@@ -56,7 +56,7 @@
56
56
  class="u-flex-1 u-field__input-wrap"
57
57
  :style="$u.toStyle(props.fieldStyle)"
58
58
  :type="(props.type as any)"
59
- :value="String(props.modelValue)"
59
+ :value="inputValue"
60
60
  :password="props.password || props.type === 'password'"
61
61
  :placeholder="String(props.placeholder)"
62
62
  :placeholderStyle="props.placeholderStyle"
@@ -74,7 +74,7 @@
74
74
  <view v-if="props.disabled" class="u-field-disabled-overlay" @tap="fieldClick"></view>
75
75
  </view>
76
76
  <u-icon
77
- v-if="props.clearable && props.modelValue != '' && focused && !props.disabled"
77
+ v-if="props.clearable && inputValue !== '' && focused && !props.disabled"
78
78
  :size="props.clearSize"
79
79
  name="close-circle-fill"
80
80
  color="var(--u-light-color)"
@@ -160,44 +160,16 @@ import { $u } from '../..';
160
160
  * @example <u-field v-model="mobile" label="手机号" required :error-message="errorMessage"></u-field>
161
161
  */
162
162
 
163
- const emit = defineEmits(['update:modelValue', 'focus', 'blur', 'confirm', 'right-icon-click', 'click']);
163
+ const emit = defineEmits(['update:modelValue', 'input', 'focus', 'blur', 'confirm', 'right-icon-click', 'click']);
164
164
 
165
- /**
166
- * field 输入框
167
- * @description 借助此组件,可以实现表单的输入, 有"text"和"textarea"类型的,此外,借助uView的picker和actionSheet组件可以快速实现上拉菜单,时间,地区选择等, 为表单解决方案的利器。
168
- * @property {string} icon label左边的图标,限uView的图标名称
169
- * @property {string} rightIcon 输入框右边的图标名称,限uView的图标名称(默认false)
170
- * @property {boolean} required 是否必填,左边显示红色"*"号(默认false)
171
- * @property {string} label 输入框左边的文字提示
172
- * @property {boolean} password 是否密码输入方式(用点替换文字),type为text时有效(默认false)
173
- * @property {boolean} clearable 是否显示右侧清空内容的图标控件(默认true)
174
- * @property {number|string} labelWidth label的宽度,单位rpx(默认130)
175
- * @property {string} labelAlign label的文字对齐方式(默认left)
176
- * @property {string} inputAlign 输入框内容对齐方式(默认left)
177
- * @property {string} iconColor 左边通过icon配置的图标的颜色(默认var(--u-content-color))
178
- * @property {boolean} autoHeight 是否自动增高输入区域,type为textarea时有效(默认true)
179
- * @property {string|boolean} errorMessage 显示的错误提示内容,如果为空字符串或者false,则不显示错误信息
180
- * @property {string} placeholder 输入框的提示文字
181
- * @property {string} placeholderStyle placeholder的样式(内联样式,字符串),如"color: var(--u-divider-color)"
182
- * @property {boolean} focus 是否自动获得焦点(默认false)
183
- * @property {boolean} fixed 如果type为textarea,且在一个"position:fixed"的区域,需要指明为true(默认false)
184
- * @property {boolean} disabled 是否不可输入(默认false)
185
- * @property {number|string} maxlength 最大输入长度,设置为 -1 的时候不限制最大长度(默认140)
186
- * @property {string} confirmType 设置键盘右下角按钮的文字,仅在type="text"时生效(默认done)
187
- * @property {string} labelPosition label位置(默认left)
188
- * @property {Record<string, any>} fieldStyle 自定义输入框的样式,对象形式
189
- * @property {number|string} clearSize 清除图标的大小,单位rpx(默认30)
190
- * @property {Record<string, any>} iconStyle 左侧图标样式
191
- * @property {boolean} borderTop 是否显示field的上边框(默认false)
192
- * @property {boolean} borderBottom 是否显示field的下边框(默认true)
193
- * @property {boolean} trim 是否自动去除输入内容首尾空格(默认true)
194
- * @property {string|number} value 输入框绑定值
195
- * @property {string} type 输入框类型(text/textarea/password等,默认text)
196
- */
197
165
  const props = defineProps(FieldProps);
198
166
 
199
167
  const focused = ref(false);
200
- const itemIndex = ref(0);
168
+
169
+ const inputValue = computed<string>(() => {
170
+ if (props.modelValue === undefined || props.modelValue === null) return '';
171
+ return String(props.modelValue);
172
+ });
201
173
 
202
174
  const inputWrapStyle = computed(() => {
203
175
  const style: Record<string, string> = {};
@@ -253,6 +225,7 @@ function onInput(event: any) {
253
225
  // 判断是否去除空格
254
226
  if (props.trim) value = $u.trim(value);
255
227
  emit('update:modelValue', value);
228
+ emit('input', value);
256
229
  }
257
230
 
258
231
  function onFocus(event: any) {
@@ -19,7 +19,7 @@
19
19
  v-if="type == 'textarea'"
20
20
  class="u-input__input u-input__textarea"
21
21
  :style="getStyle"
22
- :value="String(defaultValue)"
22
+ :value="inputValue"
23
23
  :placeholder="placeholder"
24
24
  :placeholderStyle="placeholderStyle"
25
25
  :disabled="disabled"
@@ -43,7 +43,7 @@
43
43
  class="u-input__input"
44
44
  :type="((type == 'password' ? 'text' : type) as any)"
45
45
  :style="getStyle"
46
- :value="String(defaultValue)"
46
+ :value="inputValue"
47
47
  :password="type == 'password' && !showPassword"
48
48
  :placeholder="placeholder"
49
49
  :placeholderStyle="placeholderStyle"
@@ -65,7 +65,7 @@
65
65
  <view class="u-input__right-icon u-flex">
66
66
  <view
67
67
  class="u-input__right-icon__clear u-input__right-icon__item"
68
- v-if="clearable && modelValue != '' && !disabled"
68
+ v-if="clearable && inputValue !== '' && !disabled"
69
69
  @click.stop="onClear"
70
70
  >
71
71
  <u-icon size="32" name="close-circle-fill" color="var(--u-light-color)" />
@@ -98,7 +98,7 @@
98
98
  }"
99
99
  v-if="props.type === 'textarea' && props.count"
100
100
  >
101
- {{ String(defaultValue).length }}/{{ props.maxlength }}
101
+ {{ inputValue.length }}/{{ props.maxlength }}
102
102
  </text>
103
103
  </view>
104
104
  </template>
@@ -126,7 +126,6 @@ const emit = defineEmits(['update:modelValue', 'input', 'blur', 'focus', 'confir
126
126
 
127
127
  const { emitToParent } = useChildren('u-input', 'u-form-item');
128
128
 
129
- const defaultValue = ref(props.modelValue);
130
129
  const inputHeight = 70; // input的高度
131
130
  const textareaHeight = 100; // textarea的高度
132
131
  const validateState = ref(props.validateState); // 当前input的验证状态,用于错误时,边框是否改为红色
@@ -134,11 +133,15 @@ const focused = ref(false); // 当前是否处于获得焦点的状态
134
133
  const showPassword = ref(false); // 是否预览密码
135
134
  const lastValue = ref(''); // 用于头条小程序,判断@input中,前后的值是否发生了变化
136
135
 
136
+ const inputValue = computed<string>(() => {
137
+ if (props.modelValue === undefined || props.modelValue === null) return '';
138
+ return String(props.modelValue);
139
+ });
140
+
137
141
  // 监听 value 变化
138
142
  watch(
139
- () => props.modelValue,
143
+ () => inputValue.value,
140
144
  (nVal, oVal) => {
141
- defaultValue.value = nVal;
142
145
  // 当值发生变化,且为select类型时(此时input被设置为disabled,不会触发@input事件),模拟触发@input事件
143
146
  if (nVal != oVal && props.type == 'select') handleInput({ detail: { value: nVal } });
144
147
  }
@@ -179,8 +182,6 @@ function handleInput(event: any) {
179
182
  let value = event.detail.value;
180
183
  // 判断是否去除空格
181
184
  if (props.trim) value = $u.trim(value);
182
- // 当前model 赋值
183
- defaultValue.value = value;
184
185
  emit('update:modelValue', value);
185
186
  emit('input', value);
186
187
  // 过一个生命周期再发送事件给u-form-item,否则this.$emit('update:modelValue')更新了父组件的值,但是微信小程序上
@@ -208,7 +209,7 @@ function handleBlur(event: any) {
208
209
  focused.value = false;
209
210
  }, 100);
210
211
  setTimeout(() => {
211
- let value = String(defaultValue.value);
212
+ let value = inputValue.value;
212
213
  emit('blur', value);
213
214
  // 头条小程序由于自身bug,导致中文下,每按下一个键(尚未完成输入),都会触发一次@input,导致错误,这里进行判断处理
214
215
  // #ifdef MP-TOUTIAO
@@ -2,7 +2,13 @@
2
2
  <view class="u-tabs" :style="$u.toStyle({ background: bgColor }, customStyle)" :class="customClass">
3
3
  <!-- $u.getRect()对组件根节点无效,因为写了.in(this),故这里获取内层接点尺寸 -->
4
4
  <view>
5
- <scroll-view scroll-x class="u-scroll-view" :scroll-left="scrollLeft" scroll-with-animation>
5
+ <scroll-view
6
+ scroll-x
7
+ class="u-scroll-view"
8
+ :scroll-left="scrollLeft"
9
+ :show-scrollbar="false"
10
+ scroll-with-animation
11
+ >
6
12
  <view class="u-scroll-box" :id="id" :class="{ 'u-tabs-scroll-flex': !isScroll }">
7
13
  <view
8
14
  class="u-tab-item u-line-1"
@@ -246,9 +252,7 @@ scroll-view {
246
252
  box-sizing: border-box;
247
253
  }
248
254
 
249
- /* #ifndef APP-NVUE */
250
- ::-webkit-scrollbar,
251
- ::-webkit-scrollbar,
255
+ // 隐藏滚动条样式,支持App、H5、小程序等平台
252
256
  ::-webkit-scrollbar {
253
257
  display: none;
254
258
  width: 0 !important;
@@ -256,7 +260,6 @@ scroll-view {
256
260
  -webkit-appearance: none;
257
261
  background: transparent;
258
262
  }
259
- /* #endif */
260
263
 
261
264
  .u-scroll-box {
262
265
  position: relative;
@@ -276,6 +279,13 @@ scroll-view ::v-deep ::-webkit-scrollbar {
276
279
  }
277
280
  /* #endif */
278
281
 
282
+ // App-nvue 平台使用特殊的滚动条隐藏方式
283
+ /* #ifdef APP-NVUE */
284
+ .scroll-view-nvue {
285
+ -webkit-scrollbar: none;
286
+ }
287
+ /* #endif */
288
+
279
289
  .u-scroll-view {
280
290
  width: 100%;
281
291
  white-space: nowrap;
@@ -4,6 +4,7 @@
4
4
  scroll-x
5
5
  class="u-scroll-view"
6
6
  :scroll-left="scrollLeft"
7
+ :show-scrollbar="false"
7
8
  scroll-with-animation
8
9
  :style="{ zIndex: Number(zIndex) + 1 }"
9
10
  >
@@ -315,9 +316,6 @@ scroll-view {
315
316
  transition-property: background-color, color;
316
317
  }
317
318
 
318
- /* #ifndef APP-NVUE */
319
- ::-webkit-scrollbar,
320
- ::-webkit-scrollbar,
321
319
  ::-webkit-scrollbar {
322
320
  display: none;
323
321
  width: 0 !important;
@@ -325,7 +323,6 @@ scroll-view {
325
323
  -webkit-appearance: none;
326
324
  background: transparent;
327
325
  }
328
- /* #endif */
329
326
 
330
327
  /* #ifdef H5 */
331
328
  // 通过样式穿透,隐藏H5下,scroll-view下的滚动条
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "id": "uview-pro",
3
3
  "name": "uview-pro",
4
4
  "displayName": "【支持鸿蒙】uView Pro|基于Vue3+TS的高质量UI组件库,支持多主题、暗黑模式、多语言",
5
- "version": "0.5.6",
5
+ "version": "0.5.7",
6
6
  "description": "uView Pro是基于Vue3+TS的多平台UI框架,提供80+高质量组件、便捷工具和常用模板,支持多主题、暗黑模式、多语言,支持H5/APP/鸿蒙/小程序多端开发。已在鸿蒙应用商店上架,欢迎体验!",
7
7
  "main": "index.ts",
8
8
  "module": "index.ts",