uview-plus 3.3.10 → 3.3.12
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 +14 -0
- package/components/u-form/u-form.vue +6 -1
- package/components/u-form-item/props.js +3 -3
- package/components/u-form-item/u-form-item.vue +19 -3
- package/components/u-index-list/u-index-list.vue +7 -1
- package/components/u-steps-item/u-steps-item.vue +2 -2
- package/components/u-tabs/u-tabs.vue +7 -0
- package/components/u-upload/u-upload.vue +9 -0
- package/index.js +3 -3
- package/libs/config/props/formItem.js +1 -1
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## 3.3.12(2024-08-06)
|
|
2
|
+
improvement: $u挂载时机调整便于打包分离chunk
|
|
3
|
+
|
|
4
|
+
fix: steps新增itemStyle属性名称冲突
|
|
5
|
+
|
|
6
|
+
## 3.3.11(2024-08-05)
|
|
7
|
+
feat: 新增支持upload组件的deletable/maxCount/accept变更监听 #333
|
|
8
|
+
|
|
9
|
+
feat: 新增支持tabs在swiper中使用
|
|
10
|
+
|
|
11
|
+
feat: 新增FormItem支持独立设置验证规则rules
|
|
12
|
+
|
|
13
|
+
fix: 修复index-list未设置$slots.header时索引高亮失效
|
|
14
|
+
|
|
1
15
|
## 3.3.10(2024-08-02)
|
|
2
16
|
fix: 修复index-list偶发的滑动最后一个索引报错top不存在
|
|
3
17
|
|
|
@@ -149,7 +149,12 @@
|
|
|
149
149
|
const propertyName =
|
|
150
150
|
propertyChain[propertyChain.length - 1];
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
let rule = []
|
|
153
|
+
if (child.itemRules && child.itemRules.length > 0) {
|
|
154
|
+
rule = child.itemRules
|
|
155
|
+
} else {
|
|
156
|
+
rule = this.formRules[child.prop];
|
|
157
|
+
}
|
|
153
158
|
// 如果不存在对应的规则,直接返回,否则校验器会报错
|
|
154
159
|
if (!rule) {
|
|
155
160
|
resolve()
|
|
@@ -13,9 +13,9 @@ export const props = defineMixin({
|
|
|
13
13
|
default: () => defProps.formItem.prop
|
|
14
14
|
},
|
|
15
15
|
// 绑定的规则
|
|
16
|
-
|
|
17
|
-
type:
|
|
18
|
-
default: () => defProps.formItem.
|
|
16
|
+
rules: {
|
|
17
|
+
type: Array,
|
|
18
|
+
default: () => defProps.formItem.rules
|
|
19
19
|
},
|
|
20
20
|
// 是否显示表单域的下划线边框
|
|
21
21
|
borderBottom: {
|
|
@@ -87,12 +87,12 @@
|
|
|
87
87
|
* @tutorial https://ijry.github.io/uview-plus/components/form.html
|
|
88
88
|
* @property {String} label input的label提示语
|
|
89
89
|
* @property {String} prop 绑定的值
|
|
90
|
-
* @property {
|
|
90
|
+
* @property {Array} rules 绑定的规则
|
|
91
91
|
* @property {String | Boolean} borderBottom 是否显示表单域的下划线边框
|
|
92
92
|
* @property {String | Number} labelWidth label的宽度,单位px
|
|
93
93
|
* @property {String} rightIcon 右侧图标
|
|
94
94
|
* @property {String} leftIcon 左侧图标
|
|
95
|
-
* @property {String | Object} leftIconStyle
|
|
95
|
+
* @property {String | Object} leftIconStyle 左侧图标的样式
|
|
96
96
|
* @property {Boolean} required 是否显示左边的必填星号,只作显示用,具体校验必填的逻辑,请在rules中配置 (默认 false )
|
|
97
97
|
*
|
|
98
98
|
* @example <u-form-item label="姓名" prop="userInfo.name" borderBottom ref="item1"></u-form-item>
|
|
@@ -116,7 +116,8 @@
|
|
|
116
116
|
// 错误提示方式
|
|
117
117
|
errorType: 'message'
|
|
118
118
|
},
|
|
119
|
-
color: color
|
|
119
|
+
color: color,
|
|
120
|
+
itemRules: []
|
|
120
121
|
}
|
|
121
122
|
},
|
|
122
123
|
// 组件创建完成时,将当前实例保存到u-form中
|
|
@@ -129,6 +130,15 @@
|
|
|
129
130
|
this.init()
|
|
130
131
|
},
|
|
131
132
|
emits: ["click"],
|
|
133
|
+
watch: {
|
|
134
|
+
// 监听规则的变化
|
|
135
|
+
rules: {
|
|
136
|
+
immediate: true,
|
|
137
|
+
handler(n) {
|
|
138
|
+
this.setRules(n);
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
132
142
|
methods: {
|
|
133
143
|
addStyle,
|
|
134
144
|
addUnit,
|
|
@@ -139,6 +149,12 @@
|
|
|
139
149
|
error('u-form-item需要结合u-form组件使用')
|
|
140
150
|
}
|
|
141
151
|
},
|
|
152
|
+
// 手动设置校验的规则,如果规则中有函数的话,微信小程序中会过滤掉,所以只能手动调用设置规则
|
|
153
|
+
setRules(rules) {
|
|
154
|
+
// 判断是否有规则
|
|
155
|
+
if (rules.length === 0) return;
|
|
156
|
+
this.itemRules = rules;
|
|
157
|
+
},
|
|
142
158
|
// 获取父组件的参数
|
|
143
159
|
updateParentData() {
|
|
144
160
|
// 此方法写在mixin中
|
|
@@ -436,6 +436,13 @@
|
|
|
436
436
|
getHeaderRect() {
|
|
437
437
|
// 获取header slot的高度,因为list组件中获取元素的尺寸是没有top值的
|
|
438
438
|
return new Promise(resolve => {
|
|
439
|
+
if (!this.$slots.header) {
|
|
440
|
+
resolve({
|
|
441
|
+
width: 0,
|
|
442
|
+
height: 0
|
|
443
|
+
})
|
|
444
|
+
}
|
|
445
|
+
|
|
439
446
|
// #ifndef APP-NVUE
|
|
440
447
|
this.$uGetRect('.u-index-list__header').then(size => {
|
|
441
448
|
resolve(size)
|
|
@@ -454,7 +461,6 @@
|
|
|
454
461
|
resolve(res.size)
|
|
455
462
|
})
|
|
456
463
|
// #endif
|
|
457
|
-
|
|
458
464
|
})
|
|
459
465
|
},
|
|
460
466
|
// scroll-view的滚动事件
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
:class="[`u-steps-item__line--${parentData.direction}`]" :style="[lineStyle]"></view>
|
|
5
5
|
<view class="u-steps-item__wrapper"
|
|
6
6
|
:class="[`u-steps-item__wrapper--${parentData.direction}`, parentData.dot && `u-steps-item__wrapper--${parentData.direction}--dot`]"
|
|
7
|
-
:style="[
|
|
7
|
+
:style="[itemStyleInner]">
|
|
8
8
|
<slot name="icon">
|
|
9
9
|
<view class="u-steps-item__wrapper__dot" v-if="parentData.dot" :style="{
|
|
10
10
|
backgroundColor: statusColor
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
.current ? this.parentData.activeColor : this.parentData.inactiveColor
|
|
118
118
|
return style
|
|
119
119
|
},
|
|
120
|
-
|
|
120
|
+
itemStyleInner() {
|
|
121
121
|
return {
|
|
122
122
|
...this.itemStyle
|
|
123
123
|
}
|
|
@@ -178,6 +178,7 @@
|
|
|
178
178
|
// 获取下划线的数值px表示法
|
|
179
179
|
const lineWidth = getPx(this.lineWidth);
|
|
180
180
|
this.lineOffsetLeft = lineOffsetLeft + (tabItem.rect.width - lineWidth) / 2
|
|
181
|
+
console.log(lineOffsetLeft)
|
|
181
182
|
// #ifdef APP-NVUE
|
|
182
183
|
// 第一次移动滑块,无需过渡时间
|
|
183
184
|
this.animation(this.lineOffsetLeft, this.firstTime ? 0 : parseInt(this.duration))
|
|
@@ -257,6 +258,12 @@
|
|
|
257
258
|
return
|
|
258
259
|
}
|
|
259
260
|
Promise.all([this.getTabsRect(), this.getAllItemRect()]).then(([tabsRect, itemRect = []]) => {
|
|
261
|
+
// 兼容在swiper组件中使用
|
|
262
|
+
if (tabsRect.left > tabsRect.width) {
|
|
263
|
+
tabsRect.right = tabsRect.right - Math.floor(tabsRect.left / tabsRect.width) * tabsRect.width
|
|
264
|
+
tabsRect.left = tabsRect.left % tabsRect.width
|
|
265
|
+
}
|
|
266
|
+
// console.log(tabsRect)
|
|
260
267
|
this.tabsRect = tabsRect
|
|
261
268
|
this.scrollViewWidth = 0
|
|
262
269
|
itemRect.map((item, index) => {
|
|
@@ -196,6 +196,15 @@
|
|
|
196
196
|
immediate: true,
|
|
197
197
|
deep: true,
|
|
198
198
|
},
|
|
199
|
+
deletable(newVal) {
|
|
200
|
+
this.formatFileList()
|
|
201
|
+
},
|
|
202
|
+
maxCount(newVal) {
|
|
203
|
+
this.formatFileList()
|
|
204
|
+
},
|
|
205
|
+
accept(newVal) {
|
|
206
|
+
this.formatFileList()
|
|
207
|
+
}
|
|
199
208
|
},
|
|
200
209
|
// #ifdef VUE3
|
|
201
210
|
emits: ['error', 'beforeRead', 'oversize', 'afterRead', 'delete', 'clickPreview'],
|
package/index.js
CHANGED
|
@@ -77,11 +77,11 @@ const $u = {
|
|
|
77
77
|
platform
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
// $u挂载到uni对象上
|
|
81
|
-
uni.$u = $u
|
|
82
|
-
|
|
83
80
|
const install = (Vue) => {
|
|
84
81
|
// 同时挂载到uni和Vue.prototype中
|
|
82
|
+
// $u挂载到uni对象上
|
|
83
|
+
uni.$u = $u
|
|
84
|
+
|
|
85
85
|
// #ifndef APP-NVUE
|
|
86
86
|
// 只有vue,挂载到Vue.prototype才有意义,因为nvue中全局Vue.prototype和Vue.mixin是无效的
|
|
87
87
|
Vue.config.globalProperties.$u = $u
|