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 +7 -0
- package/components/u--form/u--form.vue +8 -3
- package/components/u-form/u-form.vue +13 -7
- package/components/u-navbar/u-navbar.vue +7 -2
- package/components/u-picker/props.js +5 -0
- package/components/u-picker/u-picker.vue +7 -2
- package/libs/config/config.js +5 -1
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -42,8 +42,13 @@
|
|
|
42
42
|
// 手动设置校验的规则,如果规则中有函数的话,微信小程序中会过滤掉,所以只能手动调用设置规则
|
|
43
43
|
setRules(rules) {
|
|
44
44
|
this.$refs.uForm.setRules(rules)
|
|
45
|
-
},
|
|
46
|
-
|
|
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
|
-
|
|
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(
|
|
124
|
-
|
|
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
|
// 点击右侧区域
|
|
@@ -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="
|
|
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)) {
|
package/libs/config/config.js
CHANGED
package/package.json
CHANGED