uview-plus 3.3.7 → 3.3.8
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 +13 -0
- package/components/u-checkbox/u-checkbox.vue +1 -1
- package/components/u-collapse-item/props.js +6 -1
- package/components/u-collapse-item/u-collapse-item.vue +5 -3
- package/components/u-dropdown/u-dropdown.vue +1 -1
- package/components/u-index-list/u-index-list.vue +0 -1
- package/components/u-lazy-load/u-lazy-load.vue +10 -3
- package/components/u-loading-icon/u-loading-icon.vue +2 -0
- package/components/u-modal/u-modal.vue +3 -0
- package/components/u-parse/node/node.vue +8 -0
- package/components/u-slider/u-slider.vue +46 -8
- package/components/u-tabbar-item/u-tabbar-item.vue +3 -0
- package/components/u-tabs/u-tabs.vue +11 -2
- package/components/u-waterfall/u-waterfall.vue +10 -4
- package/libs/config/props/collapseItem.js +2 -1
- package/libs/css/flex.scss +3 -0
- package/libs/mixin/mixin.js +22 -1
- package/package.json +1 -1
- package/types/index.d.ts +4 -5
package/changelog.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
## 3.3.8(2024-07-31)
|
|
2
|
+
feat: slider支持进度条任意位置触发按钮拖动
|
|
3
|
+
|
|
4
|
+
fix: 修复app-vue下modal标题不居中
|
|
5
|
+
|
|
6
|
+
fix: #459 TS setConfig 声明异常
|
|
7
|
+
|
|
8
|
+
feat: tabs组件增加longPress长按事件
|
|
9
|
+
|
|
10
|
+
feat: 新增showRight属性控制collapse右侧图标显隐
|
|
11
|
+
|
|
12
|
+
fix: 优化nvue下css警告
|
|
13
|
+
|
|
1
14
|
## 3.3.7(2024-07-29)
|
|
2
15
|
feat: 支持IndexList组件支持在弹窗等场景下使用及联动优化
|
|
3
16
|
|
|
@@ -33,9 +33,11 @@
|
|
|
33
33
|
</slot>
|
|
34
34
|
</template>
|
|
35
35
|
<template #right-icon>
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
<template v-if="showRight">
|
|
37
|
+
<u-icon v-if="!$slots['right-icon']" :size="16" name="arrow-right"></u-icon>
|
|
38
|
+
<slot name="right-icon">
|
|
39
|
+
</slot>
|
|
40
|
+
</template>
|
|
39
41
|
</template>
|
|
40
42
|
</u-cell>
|
|
41
43
|
<view
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
// 图片高度,单位rpx
|
|
98
98
|
height: {
|
|
99
99
|
type: [Number, String],
|
|
100
|
-
default: '
|
|
100
|
+
default: '200'
|
|
101
101
|
}
|
|
102
102
|
},
|
|
103
103
|
data() {
|
|
@@ -207,9 +207,12 @@
|
|
|
207
207
|
});
|
|
208
208
|
})
|
|
209
209
|
// mounted的时候,不一定挂载了这个元素,延时30ms,否则会报错或者不报错,但是也没有效果
|
|
210
|
+
|
|
210
211
|
setTimeout(() => {
|
|
212
|
+
// #ifndef APP-NVUE
|
|
211
213
|
// 这里是组件内获取布局状态,不能用uni.createIntersectionObserver,而必须用this.createIntersectionObserver
|
|
212
214
|
// this.disconnectObserver('contentObserver');
|
|
215
|
+
// nvue 里不支持
|
|
213
216
|
const contentObserver = uni.createIntersectionObserver(this);
|
|
214
217
|
// 要理解这里怎么计算的,请看这个:
|
|
215
218
|
// https://blog.csdn.net/qq_25324335/article/details/83687695
|
|
@@ -225,6 +228,10 @@
|
|
|
225
228
|
}
|
|
226
229
|
})
|
|
227
230
|
this.contentObserver = contentObserver;
|
|
231
|
+
// #endif
|
|
232
|
+
// #ifdef APP-NVUE
|
|
233
|
+
this.isShow = true;
|
|
234
|
+
// #endif
|
|
228
235
|
}, 30)
|
|
229
236
|
}
|
|
230
237
|
}
|
|
@@ -239,13 +246,13 @@
|
|
|
239
246
|
}
|
|
240
247
|
|
|
241
248
|
.u-lazy-item {
|
|
242
|
-
width: 100%;
|
|
243
249
|
// 骗系统开启硬件加速
|
|
244
250
|
transform: transition3d(0, 0, 0);
|
|
251
|
+
/* #ifndef APP-NVUE */
|
|
245
252
|
// 防止图片加载“闪一下”
|
|
246
253
|
will-change: transform;
|
|
247
|
-
/* #ifndef APP-NVUE */
|
|
248
254
|
display: block;
|
|
255
|
+
width: 100%;
|
|
249
256
|
/* #endif */
|
|
250
257
|
}
|
|
251
258
|
</style>
|
|
@@ -315,7 +315,9 @@
|
|
|
315
315
|
height: $u-loading-icon-dot-height;
|
|
316
316
|
|
|
317
317
|
&:before {
|
|
318
|
+
/* #ifndef APP-NVUE */
|
|
318
319
|
display: block;
|
|
320
|
+
/* #endif */
|
|
319
321
|
width: $u-loading-icon-dot-before-width;
|
|
320
322
|
height: $u-loading-icon-dot-before-height;
|
|
321
323
|
margin: $u-loading-icon-dot-before-margin;
|
|
@@ -407,7 +407,9 @@ export default {
|
|
|
407
407
|
._a {
|
|
408
408
|
padding: 1.5px 0 1.5px 0;
|
|
409
409
|
color: #366092;
|
|
410
|
+
/* #ifndef APP-NVUE */
|
|
410
411
|
word-break: break-all;
|
|
412
|
+
/* #endif */
|
|
411
413
|
}
|
|
412
414
|
|
|
413
415
|
/* a 标签点击态效果 */
|
|
@@ -425,7 +427,9 @@ export default {
|
|
|
425
427
|
/* 内部样式 */
|
|
426
428
|
|
|
427
429
|
._block {
|
|
430
|
+
/* #ifndef APP-NVUE */
|
|
428
431
|
display: block;
|
|
432
|
+
/* #endif */
|
|
429
433
|
}
|
|
430
434
|
|
|
431
435
|
._b,
|
|
@@ -472,7 +476,9 @@ export default {
|
|
|
472
476
|
._h4,
|
|
473
477
|
._h5,
|
|
474
478
|
._h6 {
|
|
479
|
+
/* #ifndef APP-NVUE */
|
|
475
480
|
display: block;
|
|
481
|
+
/* #endif */
|
|
476
482
|
font-weight: bold;
|
|
477
483
|
}
|
|
478
484
|
|
|
@@ -494,7 +500,9 @@ export default {
|
|
|
494
500
|
|
|
495
501
|
._ol,
|
|
496
502
|
._ul {
|
|
503
|
+
/* #ifndef APP-NVUE */
|
|
497
504
|
display: block;
|
|
505
|
+
/* #endif */
|
|
498
506
|
padding-left: 40px;
|
|
499
507
|
margin: 1em 0;
|
|
500
508
|
}
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
:style="[addStyle(customStyle)]"
|
|
5
5
|
>
|
|
6
6
|
<template v-if="!useNative || isRange">
|
|
7
|
-
<view ref="u-slider-inner" class="u-slider-inner" @
|
|
7
|
+
<view ref="u-slider-inner" class="u-slider-inner" @click="onClick"
|
|
8
|
+
@onTouchStart="onTouchStart2($event, 1)" @touchmove="onTouchMove2($event, 1)"
|
|
9
|
+
@touchend="onTouchEnd2($event, 1)" @touchcancel="onTouchEnd2($event, 1)"
|
|
8
10
|
:class="[disabled ? 'u-slider--disabled' : '']" :style="{
|
|
9
11
|
height: (isRange && showValue) ? (getPx(blockSize) + 24) + 'px' : (getPx(blockSize)) + 'px',
|
|
10
12
|
}"
|
|
@@ -248,6 +250,22 @@
|
|
|
248
250
|
}
|
|
249
251
|
// 标示当前的状态为开始触摸滑动
|
|
250
252
|
this.status = 'start';
|
|
253
|
+
|
|
254
|
+
let clientX = 0;
|
|
255
|
+
// #ifndef APP-NVUE
|
|
256
|
+
clientX = touches.clientX;
|
|
257
|
+
// #endif
|
|
258
|
+
// #ifdef APP-NVUE
|
|
259
|
+
clientX = touches.screenX;
|
|
260
|
+
// #endif
|
|
261
|
+
this.distanceX = clientX - this.sliderRect.left;
|
|
262
|
+
// 获得移动距离对整个滑块的值,此为带有多位小数的值,不能用此更新视图
|
|
263
|
+
// 否则造成通信阻塞,需要每改变一个step值时修改一次视图
|
|
264
|
+
this.newValue = ((this.distanceX / this.sliderRect.width) * (this.max - this.min)) + parseFloat(this.min);
|
|
265
|
+
this.status = 'moving';
|
|
266
|
+
// 发出moving事件
|
|
267
|
+
this.$emit('changing');
|
|
268
|
+
this.updateValue(this.newValue, true, index);
|
|
251
269
|
},
|
|
252
270
|
onTouchMove(event, index = 1) {
|
|
253
271
|
if (this.disabled) return;
|
|
@@ -255,7 +273,7 @@
|
|
|
255
273
|
// 触摸后第一次移动已经将status设置为moving状态,故触摸第二次移动不会触发本事件
|
|
256
274
|
if (this.status == 'start') this.$emit('start');
|
|
257
275
|
let touches = event.touches[0];
|
|
258
|
-
|
|
276
|
+
console.log('touchs', touches)
|
|
259
277
|
// 滑块的左边不一定跟屏幕左边接壤,所以需要减去最外层父元素的左边值
|
|
260
278
|
let clientX = 0;
|
|
261
279
|
// #ifndef APP-NVUE
|
|
@@ -281,6 +299,32 @@
|
|
|
281
299
|
}
|
|
282
300
|
this.status = 'end';
|
|
283
301
|
},
|
|
302
|
+
onTouchStart2(event, index = 1) {
|
|
303
|
+
if (!this.isRange) {
|
|
304
|
+
this.onChangeStart(event, index);
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
onTouchMove2(event, index = 1) {
|
|
308
|
+
if (!this.isRange) {
|
|
309
|
+
this.onTouchMove(event, index);
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
onTouchEnd2(event, index = 1) {
|
|
313
|
+
if (!this.isRange) {
|
|
314
|
+
this.onTouchEnd(event, index);
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
onClick(event) {
|
|
318
|
+
if (this.disabled) return;
|
|
319
|
+
// 直接点击滑块的情况,计算方式与onTouchMove方法相同
|
|
320
|
+
// console.log('click', event)
|
|
321
|
+
// #ifndef APP-NVUE
|
|
322
|
+
// nvue下暂时无法获取坐标
|
|
323
|
+
let clientX = event.detail.x - this.sliderRect.left
|
|
324
|
+
this.newValue = ((clientX / this.sliderRect.width) * (this.max - this.min)) + parseFloat(this.min);
|
|
325
|
+
this.updateValue(this.newValue, false, 1);
|
|
326
|
+
// #endif
|
|
327
|
+
},
|
|
284
328
|
updateValue(value, drag, index = 1) {
|
|
285
329
|
// 去掉小数部分,同时也是对step步进的处理
|
|
286
330
|
let valueFormat = this.format(value, index);
|
|
@@ -350,12 +394,6 @@
|
|
|
350
394
|
/ this.step
|
|
351
395
|
) * this.step;
|
|
352
396
|
}
|
|
353
|
-
},
|
|
354
|
-
onClick(event) {
|
|
355
|
-
if (this.disabled) return;
|
|
356
|
-
// 直接点击滑块的情况,计算方式与onTouchMove方法相同
|
|
357
|
-
const value = ((event.detail.x - this.sliderRect.left) / this.sliderRect.width) * 100;
|
|
358
|
-
this.updateValue(value, false);
|
|
359
397
|
}
|
|
360
398
|
}
|
|
361
399
|
}
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
v-for="(item, index) in list"
|
|
21
21
|
:key="index"
|
|
22
22
|
@tap="clickHandler(item, index)"
|
|
23
|
+
@longpress="longPressHandler(item,index)"
|
|
23
24
|
:ref="`u-tabs__wrapper__nav__item-${index}`"
|
|
24
25
|
:style="[addStyle(itemStyle), {flex: scrollable ? '' : 1}]"
|
|
25
26
|
:class="[`u-tabs__wrapper__nav__item-${index}`, item.disabled && 'u-tabs__wrapper__nav__item--disabled']"
|
|
@@ -102,7 +103,8 @@
|
|
|
102
103
|
* @property {String} keyName 从`list`元素对象中读取的键名(默认 'name' )
|
|
103
104
|
* @event {Function(index)} change 标签改变时触发 index: 点击了第几个tab,索引从0开始
|
|
104
105
|
* @event {Function(index)} click 点击标签时触发 index: 点击了第几个tab,索引从0开始
|
|
105
|
-
* @
|
|
106
|
+
* @event {Function(index)} longPress 长按标签时触发 index: 点击了第几个tab,索引从0开始
|
|
107
|
+
* @example <u-tabs :list="list" :is-scroll="false" :current="current" @change="change" @longPress="longPress"></u-tabs>
|
|
106
108
|
*/
|
|
107
109
|
export default {
|
|
108
110
|
name: 'u-tabs',
|
|
@@ -160,7 +162,7 @@
|
|
|
160
162
|
async mounted() {
|
|
161
163
|
this.init()
|
|
162
164
|
},
|
|
163
|
-
emits: ['click', 'change', 'update:current'],
|
|
165
|
+
emits: ['click', 'longPress', 'change', 'update:current'],
|
|
164
166
|
methods: {
|
|
165
167
|
addStyle,
|
|
166
168
|
addUnit,
|
|
@@ -218,6 +220,13 @@
|
|
|
218
220
|
index
|
|
219
221
|
}, index)
|
|
220
222
|
},
|
|
223
|
+
// 长按事件
|
|
224
|
+
longPressHandler(item, index) {
|
|
225
|
+
this.$emit('longPress', {
|
|
226
|
+
...item,
|
|
227
|
+
index
|
|
228
|
+
})
|
|
229
|
+
},
|
|
221
230
|
init() {
|
|
222
231
|
sleep().then(() => {
|
|
223
232
|
this.resize()
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="u-waterfall">
|
|
3
|
-
<view id="u-left-column" class="u-column">
|
|
3
|
+
<view ref="u-left-column" id="u-left-column" class="u-column">
|
|
4
4
|
<slot name="left" :leftList="leftList"></slot>
|
|
5
5
|
</view>
|
|
6
|
-
<view id="u-right-column" class="u-column">
|
|
6
|
+
<view ref="u-right-column" id="u-right-column" class="u-column">
|
|
7
7
|
<slot name="right" :rightList="rightList"></slot>
|
|
8
8
|
</view>
|
|
9
9
|
</view>
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
* @property {String Number} add-time 单条数据添加到队列的时间间隔,单位ms,见上方注意事项说明(默认200)
|
|
19
19
|
* @example <u-waterfall :flowList="flowList"></u-waterfall>
|
|
20
20
|
*/
|
|
21
|
+
import { mpMixin } from '../../libs/mixin/mpMixin';
|
|
22
|
+
import { mixin } from '../../libs/mixin/mixin';
|
|
21
23
|
export default {
|
|
22
24
|
name: "u-waterfall",
|
|
23
25
|
props: {
|
|
@@ -54,6 +56,7 @@
|
|
|
54
56
|
default: 'id'
|
|
55
57
|
}
|
|
56
58
|
},
|
|
59
|
+
mixins: [mpMixin, mixin],
|
|
57
60
|
data() {
|
|
58
61
|
return {
|
|
59
62
|
leftList: [],
|
|
@@ -156,7 +159,7 @@
|
|
|
156
159
|
// #endif
|
|
157
160
|
// #ifdef VUE3
|
|
158
161
|
index = this.modelValue.findIndex(val => val[this.idKey] == id);
|
|
159
|
-
if (index != -1) this.$emit('
|
|
162
|
+
if (index != -1) this.$emit('update:modelValue', this.modelValue.splice(index, 1));
|
|
160
163
|
// #endif
|
|
161
164
|
},
|
|
162
165
|
// 修改某条数据的某个属性
|
|
@@ -216,10 +219,13 @@
|
|
|
216
219
|
@include flex;
|
|
217
220
|
flex: 1;
|
|
218
221
|
flex-direction: column;
|
|
222
|
+
overflow: hidden;
|
|
223
|
+
/* #ifndef APP-NVUE */
|
|
219
224
|
height: 100%;
|
|
225
|
+
/* #endif */
|
|
220
226
|
}
|
|
221
227
|
|
|
222
228
|
.u-image {
|
|
223
|
-
width: 100%;
|
|
229
|
+
max-width: 100%;
|
|
224
230
|
}
|
|
225
231
|
</style>
|
package/libs/css/flex.scss
CHANGED
|
@@ -216,6 +216,7 @@
|
|
|
216
216
|
// 多轴交叉时的对齐方式
|
|
217
217
|
|
|
218
218
|
// 起点对齐
|
|
219
|
+
/* #ifndef APP-NVUE */
|
|
219
220
|
.u-flex-content-start {
|
|
220
221
|
align-content: flex-start;
|
|
221
222
|
}
|
|
@@ -258,6 +259,8 @@
|
|
|
258
259
|
flex-shrink: 1;
|
|
259
260
|
}
|
|
260
261
|
|
|
262
|
+
/* #endif */
|
|
263
|
+
|
|
261
264
|
// 定义内外边距,历遍1-80
|
|
262
265
|
@for $i from 0 through 80 {
|
|
263
266
|
// 只要双数和能被5除尽的数
|
package/libs/mixin/mixin.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { defineMixin } from '../vue'
|
|
2
|
-
import { deepMerge, $parent } from '../function/index'
|
|
2
|
+
import { deepMerge, $parent, sleep } from '../function/index'
|
|
3
3
|
import test from '../function/test'
|
|
4
4
|
import route from '../util/route'
|
|
5
|
+
// #ifdef APP-NVUE
|
|
6
|
+
// 由于weex为阿里的KPI业绩考核的产物,所以不支持百分比单位,这里需要通过dom查询组件的宽度
|
|
7
|
+
const dom = uni.requireNativePlugin('dom')
|
|
8
|
+
// #endif
|
|
5
9
|
|
|
6
10
|
export const mixin = defineMixin({
|
|
7
11
|
// 定义每个组件都可能需要用到的外部样式以及类名
|
|
@@ -107,6 +111,7 @@ export const mixin = defineMixin({
|
|
|
107
111
|
// 解决办法为在组件根部再套一个没有任何作用的view元素
|
|
108
112
|
$uGetRect(selector, all) {
|
|
109
113
|
return new Promise((resolve) => {
|
|
114
|
+
// #ifndef APP-NVUE
|
|
110
115
|
uni.createSelectorQuery()
|
|
111
116
|
.in(this)[all ? 'selectAll' : 'select'](selector)
|
|
112
117
|
.boundingClientRect((rect) => {
|
|
@@ -118,6 +123,22 @@ export const mixin = defineMixin({
|
|
|
118
123
|
}
|
|
119
124
|
})
|
|
120
125
|
.exec()
|
|
126
|
+
// #endif
|
|
127
|
+
|
|
128
|
+
// #ifdef APP-NVUE
|
|
129
|
+
sleep(30).then(() => {
|
|
130
|
+
let selectorNvue = selector.substring(1) // 去掉开头的#或者.
|
|
131
|
+
let selectorRef = this.$refs[selectorNvue]
|
|
132
|
+
if (!selectorRef) {
|
|
133
|
+
console.log('不存在元素,请检查是否设置了ref属性' + selectorNvue + '。')
|
|
134
|
+
resolve({})
|
|
135
|
+
}
|
|
136
|
+
dom.getComponentRect(selectorRef, res => {
|
|
137
|
+
// console.log(res)
|
|
138
|
+
resolve(res.size)
|
|
139
|
+
})
|
|
140
|
+
})
|
|
141
|
+
// #endif
|
|
121
142
|
})
|
|
122
143
|
},
|
|
123
144
|
getParentData(parentName = '') {
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -77,9 +77,8 @@ declare module 'uview-plus' {
|
|
|
77
77
|
interface Config {
|
|
78
78
|
v: string;
|
|
79
79
|
version: string;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
unit: 'px'
|
|
80
|
+
color: Partial<Color>;
|
|
81
|
+
unit: 'px' | 'rpx'
|
|
83
82
|
}
|
|
84
83
|
interface Color {
|
|
85
84
|
primary: string,
|
|
@@ -95,7 +94,7 @@ declare module 'uview-plus' {
|
|
|
95
94
|
borderColor: string
|
|
96
95
|
}
|
|
97
96
|
interface GlobalConfig {
|
|
98
|
-
config: Config
|
|
97
|
+
config: Partial<Config>;
|
|
99
98
|
props: {};
|
|
100
99
|
}
|
|
101
100
|
interface $u {
|
|
@@ -149,7 +148,7 @@ declare module 'uview-plus' {
|
|
|
149
148
|
platform: string;
|
|
150
149
|
}
|
|
151
150
|
|
|
152
|
-
export function setConfig(config: GlobalConfig): void;
|
|
151
|
+
export function setConfig(config: Partial<GlobalConfig>): void;
|
|
153
152
|
|
|
154
153
|
global {
|
|
155
154
|
interface Uni {
|