uview-plus 3.3.66 → 3.3.67

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,3 +1,10 @@
1
+ ## 3.3.67(2025-02-11)
2
+ feat: navbar支持返回全局拦截器配置
3
+
4
+ feat: 表单-校验-支持无提示-得到校验结果
5
+
6
+ feat: picker传递hasInput属性时候,可以禁用输入框点击
7
+
1
8
  ## 3.3.66(2025-02-09)
2
9
  feat: steps-item增加content插槽
3
10
 
@@ -42,8 +42,13 @@
42
42
  // 手动设置校验的规则,如果规则中有函数的话,微信小程序中会过滤掉,所以只能手动调用设置规则
43
43
  setRules(rules) {
44
44
  this.$refs.uForm.setRules(rules)
45
- },
46
- validate() {
45
+ },
46
+ /**
47
+ * 校验全部数据
48
+ * @param {Object} options
49
+ * @param {Boolean} options.showErrorMsg -是否显示校验信息,
50
+ */
51
+ validate(options) {
47
52
  /**
48
53
  * 在微信小程序中,通过this.$parent拿到的父组件是u--form,而不是其内嵌的u-form
49
54
  * 导致在u-form组件中,拿不到对应的children数组,从而校验无效,所以这里每次调用u-form组件中的
@@ -52,7 +57,7 @@
52
57
  // #ifdef MP-WEIXIN
53
58
  this.setMpData()
54
59
  // #endif
55
- return this.$refs.uForm.validate()
60
+ return this.$refs.uForm.validate(options)
56
61
  },
57
62
  validateField(value, callback) {
58
63
  // #ifdef MP-WEIXIN
@@ -126,7 +126,7 @@
126
126
  });
127
127
  },
128
128
  // 对部分表单字段进行校验
129
- async validateField(value, callback, event = null) {
129
+ async validateField(value, callback, event = null,options) {
130
130
  // $nextTick是必须的,否则model的变更,可能会延后于此方法的执行
131
131
  this.$nextTick(() => {
132
132
  // 校验错误信息,返回给回调方法,用于存放所有form-item的错误信息
@@ -190,10 +190,12 @@
190
190
  });
191
191
  errorsRes.push(...errors);
192
192
  childErrors.push(...errors);
193
+ }
194
+ //没有配置,或者配置了showErrorMsg为true时候,才修改子组件message,默认没有配置
195
+ if(!options||options?.showErrorMsg==true){
196
+ child.message =
197
+ childErrors[0]?.message ? childErrors[0].message : null;
193
198
  }
194
- child.message =
195
- childErrors[0]?.message ? childErrors[0].message : null;
196
-
197
199
  if (i == (rules.length - 1)) {
198
200
  resolve(errorsRes)
199
201
  }
@@ -217,8 +219,12 @@
217
219
  });
218
220
  });
219
221
  },
220
- // 校验全部数据
221
- validate(callback) {
222
+ /**
223
+ * 校验全部数据
224
+ * @param {Object} options
225
+ * @param {Boolean} options.showErrorMsg -是否显示校验信息,
226
+ */
227
+ validate(options) {
222
228
  // 开发环境才提示,生产环境不会提示
223
229
  if (process.env.NODE_ENV === 'development' && Object.keys(this.formRules).length === 0) {
224
230
  error('未设置rules,请看文档说明!如果已经设置,请刷新页面。');
@@ -240,7 +246,7 @@
240
246
  } else {
241
247
  resolve(true)
242
248
  }
243
- });
249
+ },null,options);
244
250
  });
245
251
  });
246
252
  },
@@ -77,6 +77,7 @@
77
77
  import { props } from './props';
78
78
  import { mpMixin } from '../../libs/mixin/mpMixin';
79
79
  import { mixin } from '../../libs/mixin/mixin';
80
+ import config from '../../libs/config/config';
80
81
  import { addUnit, addStyle, getPx, getWindowInfo } from '../../libs/function/index';
81
82
  /**
82
83
  * Navbar 自定义导航栏
@@ -120,8 +121,12 @@
120
121
  leftClick() {
121
122
  // 如果配置了autoBack,自动返回上一页
122
123
  this.$emit('leftClick')
123
- if(this.autoBack) {
124
- uni.navigateBack()
124
+ if (config.interceptor.navbarLeftClick != null) {
125
+ config.interceptor.navbarLeftClick()
126
+ } else {
127
+ if(this.autoBack) {
128
+ uni.navigateBack()
129
+ }
125
130
  }
126
131
  },
127
132
  // 点击右侧区域
@@ -5,6 +5,11 @@ export const props = defineMixin({
5
5
  modelValue: {
6
6
  type: Array,
7
7
  default: () => []
8
+ },
9
+ //是否禁用
10
+ disabled: {
11
+ type: Boolean,
12
+ default: false
8
13
  },
9
14
  hasInput: {
10
15
  type: Boolean,
@@ -1,8 +1,8 @@
1
1
  <template>
2
2
  <view class="u-picker-warrper">
3
- <view v-if="hasInput" class="u-picker-input cursor-pointer" @click="showByClickInput = !showByClickInput">
3
+ <view v-if="hasInput" class="u-picker-input cursor-pointer" @click="onShowByClickInput">
4
4
  <slot>
5
- <up-input :placeholder="placeholder" :readonly="true" border="surround" v-model="inputLabel"></up-input>
5
+ <up-input :disabled="disabled" :placeholder="placeholder" :readonly="true" border="surround" v-model="inputLabel"></up-input>
6
6
  <div class="input-cover"></div>
7
7
  </slot>
8
8
  </view>
@@ -177,6 +177,11 @@ export default {
177
177
  methods: {
178
178
  addUnit,
179
179
  testArray: test.array,
180
+ onShowByClickInput(){
181
+ if(!this.disabled){
182
+ this.showByClickInput=!this.showByClickInput;
183
+ }
184
+ },
180
185
  // 获取item需要显示的文字,判别为对象还是文本
181
186
  getItemText(item) {
182
187
  if (test.object(item)) {
@@ -38,5 +38,9 @@ export default {
38
38
  'up-light-color': '#c0c4cc'
39
39
  },
40
40
  // 默认单位,可以通过配置为rpx,那么在用于传入组件大小参数为数值时,就默认为rpx
41
- unit: 'px'
41
+ unit: 'px',
42
+ // 拦截器
43
+ interceptor: {
44
+ navbarLeftClick: null
45
+ }
42
46
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "id": "uview-plus",
3
3
  "name": "uview-plus",
4
4
  "displayName": "零云®uview-plus3.0重磅发布,全面的Vue3鸿蒙移动组件库。",
5
- "version": "3.3.66",
5
+ "version": "3.3.67",
6
6
  "description": "零云®uview-plus已兼容vue3,全面的组件和便捷的工具会让您信手拈来,如鱼得水",
7
7
  "keywords": [
8
8
  "uview",