uview-plus 3.3.5 → 3.3.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 +55 -0
- package/components/u-action-sheet/props.js +6 -1
- package/components/u-action-sheet/u-action-sheet.vue +4 -5
- package/components/u-album/props.js +10 -0
- package/components/u-album/u-album.vue +9 -3
- package/components/u-calendar/header.vue +2 -0
- package/components/u-calendar/month.vue +1 -0
- package/components/u-cell/u-cell.vue +20 -1
- package/components/u-checkbox/u-checkbox.vue +28 -18
- package/components/u-code/u-code.vue +0 -5
- package/components/u-count-down/u-count-down.vue +0 -5
- package/components/u-form-item/u-form-item.vue +1 -1
- package/components/u-grid-item/u-grid-item.vue +0 -5
- package/components/u-index-list/props.js +6 -1
- package/components/u-index-list/u-index-list.vue +169 -42
- package/components/u-modal/u-modal.vue +3 -3
- package/components/u-notify/u-notify.vue +0 -5
- package/components/u-number-box/u-number-box.vue +1 -0
- package/components/u-parse/node/node.vue +1 -1
- package/components/u-parse/u-parse.vue +1 -7
- package/components/u-picker/u-picker.vue +2 -1
- package/components/u-popup/u-popup.vue +3 -1
- package/components/u-row-notice/u-row-notice.vue +1 -8
- package/components/u-scroll-list/nvue.js +1 -1
- package/components/u-scroll-list/u-scroll-list.vue +5 -2
- package/components/u-slider/props.js +45 -19
- package/components/u-slider/u-slider.vue +376 -7
- package/components/u-sticky/u-sticky.vue +0 -5
- package/components/u-swipe-action-item/nvue.js +0 -5
- package/components/u-tabs/u-tabs.vue +11 -3
- package/components/u-toast/u-toast.vue +10 -10
- package/components/u-upload/u-upload.vue +9 -4
- package/components/u-upload/utils.js +10 -4
- package/components/u-waterfall/u-waterfall.vue +1 -1
- package/libs/config/props/actionSheet.js +2 -1
- package/libs/config/props/indexList.js +2 -1
- package/libs/config/props/slider.js +3 -1
- package/libs/css/common.scss +1 -1
- package/libs/mixin/mixin.js +1 -7
- package/package.json +1 -1
- package/types/comps/album.d.ts +10 -0
- package/types/index.d.ts +155 -29
- package/components/u-slider/nvue - /345/211/257/346/234/254.js" +0 -180
|
@@ -3,7 +3,82 @@
|
|
|
3
3
|
class="u-slider"
|
|
4
4
|
:style="[addStyle(customStyle)]"
|
|
5
5
|
>
|
|
6
|
+
<template v-if="!useNative || isRange">
|
|
7
|
+
<view ref="u-slider-inner" class="u-slider-inner" @tap="onClick"
|
|
8
|
+
:class="[disabled ? 'u-slider--disabled' : '']" :style="{
|
|
9
|
+
height: (isRange && showValue) ? (getPx(blockSize) + 24) + 'px' : (getPx(blockSize)) + 'px',
|
|
10
|
+
}"
|
|
11
|
+
>
|
|
12
|
+
<view ref="u-slider__base"
|
|
13
|
+
class="u-slider__base"
|
|
14
|
+
:style="[
|
|
15
|
+
{
|
|
16
|
+
height: height,
|
|
17
|
+
backgroundColor: inactiveColor
|
|
18
|
+
}
|
|
19
|
+
]"
|
|
20
|
+
>
|
|
21
|
+
</view>
|
|
22
|
+
<view
|
|
23
|
+
class="u-slider__gap"
|
|
24
|
+
:style="[
|
|
25
|
+
barStyle,
|
|
26
|
+
{
|
|
27
|
+
height: height,
|
|
28
|
+
marginTop: '-' + height,
|
|
29
|
+
backgroundColor: activeColor
|
|
30
|
+
}
|
|
31
|
+
]"
|
|
32
|
+
>
|
|
33
|
+
</view>
|
|
34
|
+
<view v-if="isRange"
|
|
35
|
+
class="u-slider__gap u-slider__gap-0"
|
|
36
|
+
:style="[
|
|
37
|
+
barStyle0,
|
|
38
|
+
{
|
|
39
|
+
height: height,
|
|
40
|
+
marginTop: '-' + height,
|
|
41
|
+
backgroundColor: inactiveColor
|
|
42
|
+
}
|
|
43
|
+
]"
|
|
44
|
+
>
|
|
45
|
+
</view>
|
|
46
|
+
<text v-if="isRange && showValue"
|
|
47
|
+
class="u-slider__show-range-value" :style="{left: (getPx(barStyle0.width) + getPx(blockSize)/2) + 'px'}">
|
|
48
|
+
{{ this.rangeValue[0] }}
|
|
49
|
+
</text>
|
|
50
|
+
<text v-if="isRange && showValue"
|
|
51
|
+
class="u-slider__show-range-value" :style="{left: (getPx(barStyle.width) + getPx(blockSize)/2) + 'px'}">
|
|
52
|
+
{{ this.rangeValue[1] }}
|
|
53
|
+
</text>
|
|
54
|
+
<template v-if="isRange">
|
|
55
|
+
<view class="u-slider__button-wrap u-slider__button-wrap-0" @touchstart="onTouchStart($event, 0)"
|
|
56
|
+
@touchmove="onTouchMove($event, 0)" @touchend="onTouchEnd($event, 0)"
|
|
57
|
+
@touchcancel="onTouchEnd($event, 0)" :style="{left: (getPx(barStyle0.width) + getPx(blockSize)/2) + 'px'}">
|
|
58
|
+
<slot v-if="$slots.default || $slots.$default"/>
|
|
59
|
+
<view v-else class="u-slider__button" :style="[blockStyle, {
|
|
60
|
+
height: getPx(blockSize, true),
|
|
61
|
+
width: getPx(blockSize, true),
|
|
62
|
+
backgroundColor: blockColor
|
|
63
|
+
}]"></view>
|
|
64
|
+
</view>
|
|
65
|
+
</template>
|
|
66
|
+
<view class="u-slider__button-wrap" @touchstart="onTouchStart"
|
|
67
|
+
@touchmove="onTouchMove" @touchend="onTouchEnd"
|
|
68
|
+
@touchcancel="onTouchEnd" :style="{left: (getPx(barStyle.width) + getPx(blockSize)/2) + 'px'}">
|
|
69
|
+
<slot v-if="$slots.default || $slots.$default"/>
|
|
70
|
+
<view v-else class="u-slider__button" :style="[blockStyle, {
|
|
71
|
+
height: getPx(blockSize, true),
|
|
72
|
+
width: getPx(blockSize, true),
|
|
73
|
+
backgroundColor: blockColor
|
|
74
|
+
}]"></view>
|
|
75
|
+
</view>
|
|
76
|
+
</view>
|
|
77
|
+
<view class="u-slider__show-value" v-if="showValue && !isRange">{{ modelValue }}</view>
|
|
78
|
+
</template>
|
|
6
79
|
<slider
|
|
80
|
+
class="u-slider__native"
|
|
81
|
+
v-else
|
|
7
82
|
:min="min"
|
|
8
83
|
:max="max"
|
|
9
84
|
:step="step"
|
|
@@ -24,15 +99,105 @@
|
|
|
24
99
|
import { props } from './props';
|
|
25
100
|
import { mpMixin } from '../../libs/mixin/mpMixin';
|
|
26
101
|
import { mixin } from '../../libs/mixin/mixin';
|
|
27
|
-
import { addStyle, getPx } from '../../libs/function/index.js';
|
|
102
|
+
import { addStyle, getPx, sleep } from '../../libs/function/index.js';
|
|
103
|
+
// #ifdef APP-NVUE
|
|
104
|
+
const dom = uni.requireNativePlugin('dom')
|
|
105
|
+
// #endif
|
|
106
|
+
/**
|
|
107
|
+
* slider 滑块选择器
|
|
108
|
+
* @tutorial https://uview-plus.jiangruyi.com/components/slider.html
|
|
109
|
+
* @property {Number | String} value 滑块默认值(默认0)
|
|
110
|
+
* @property {Number | String} min 最小值(默认0)
|
|
111
|
+
* @property {Number | String} max 最大值(默认100)
|
|
112
|
+
* @property {Number | String} step 步长(默认1)
|
|
113
|
+
* @property {Number | String} blockWidth 滑块宽度,高等于宽(30)
|
|
114
|
+
* @property {Number | String} height 滑块条高度,单位rpx(默认6)
|
|
115
|
+
* @property {String} inactiveColor 底部条背景颜色(默认#c0c4cc)
|
|
116
|
+
* @property {String} activeColor 底部选择部分的背景颜色(默认#2979ff)
|
|
117
|
+
* @property {String} blockColor 滑块颜色(默认#ffffff)
|
|
118
|
+
* @property {Object} blockStyle 给滑块自定义样式,对象形式
|
|
119
|
+
* @property {Boolean} disabled 是否禁用滑块(默认为false)
|
|
120
|
+
* @event {Function} changing 正在滑动中
|
|
121
|
+
* @event {Function} change 滑动结束
|
|
122
|
+
* @example <up-slider v-model="value" />
|
|
123
|
+
*/
|
|
28
124
|
export default {
|
|
29
|
-
name: '
|
|
125
|
+
name: 'u-slider',
|
|
30
126
|
mixins: [mpMixin, mixin, props],
|
|
31
|
-
emits: ["changing", "change", "update:modelValue"],
|
|
127
|
+
emits: ["start", "changing", "change", "update:modelValue"],
|
|
128
|
+
data() {
|
|
129
|
+
return {
|
|
130
|
+
startX: 0,
|
|
131
|
+
status: 'end',
|
|
132
|
+
newValue: 0,
|
|
133
|
+
distanceX: 0,
|
|
134
|
+
startValue0: 0,
|
|
135
|
+
startValue: 0,
|
|
136
|
+
barStyle0: {},
|
|
137
|
+
barStyle: {},
|
|
138
|
+
sliderRect: {
|
|
139
|
+
left: 0,
|
|
140
|
+
width: 0
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
},
|
|
144
|
+
watch: {
|
|
145
|
+
// #ifdef VUE3
|
|
146
|
+
modelValue(n) {
|
|
147
|
+
// 只有在非滑动状态时,才可以通过value更新滑块值,这里监听,是为了让用户触发
|
|
148
|
+
if(this.status == 'end') this.updateValue(this.modelValue, false);
|
|
149
|
+
},
|
|
150
|
+
// #endif
|
|
151
|
+
// #ifdef VUE2
|
|
152
|
+
value(n) {
|
|
153
|
+
// 只有在非滑动状态时,才可以通过value更新滑块值,这里监听,是为了让用户触发
|
|
154
|
+
if(this.status == 'end') this.updateValue(this.value, false);
|
|
155
|
+
}
|
|
156
|
+
// #endif
|
|
157
|
+
},
|
|
158
|
+
created() {
|
|
159
|
+
},
|
|
160
|
+
async mounted() {
|
|
161
|
+
// 获取滑块条的尺寸信息
|
|
162
|
+
if (!this.useNative) {
|
|
163
|
+
// #ifndef APP-NVUE
|
|
164
|
+
this.$uGetRect('.u-slider__base').then(rect => {
|
|
165
|
+
this.sliderRect = rect;
|
|
166
|
+
this.init()
|
|
167
|
+
});
|
|
168
|
+
// #endif
|
|
169
|
+
// #ifdef APP-NVUE
|
|
170
|
+
await sleep(30) // 不延迟会出现size获取都为0的问题
|
|
171
|
+
const ref = this.$refs['u-slider__base']
|
|
172
|
+
ref &&
|
|
173
|
+
dom.getComponentRect(ref, (res) => {
|
|
174
|
+
// console.log(res)
|
|
175
|
+
this.sliderRect = {
|
|
176
|
+
left: res.size.left,
|
|
177
|
+
width: res.size.width
|
|
178
|
+
};
|
|
179
|
+
this.init()
|
|
180
|
+
})
|
|
181
|
+
// #endif
|
|
182
|
+
}
|
|
183
|
+
},
|
|
32
184
|
methods: {
|
|
33
185
|
addStyle,
|
|
34
186
|
getPx,
|
|
35
|
-
|
|
187
|
+
init() {
|
|
188
|
+
if (this.isRange) {
|
|
189
|
+
this.updateValue(this.rangeValue[0], false, 0);
|
|
190
|
+
this.updateValue(this.rangeValue[1], false, 1);
|
|
191
|
+
} else {
|
|
192
|
+
// #ifdef VUE3
|
|
193
|
+
this.updateValue(this.modelValue, false);
|
|
194
|
+
// #endif
|
|
195
|
+
// #ifdef VUE2
|
|
196
|
+
this.updateValue(this.value, false);
|
|
197
|
+
// #endif
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
// native拖动过程中触发
|
|
36
201
|
changingHandler(e) {
|
|
37
202
|
const {
|
|
38
203
|
value
|
|
@@ -47,7 +212,7 @@
|
|
|
47
212
|
// 触发事件
|
|
48
213
|
this.$emit('changing', value)
|
|
49
214
|
},
|
|
50
|
-
// 滑动结束时触发
|
|
215
|
+
// native滑动结束时触发
|
|
51
216
|
changeHandler(e) {
|
|
52
217
|
const {
|
|
53
218
|
value
|
|
@@ -60,12 +225,216 @@
|
|
|
60
225
|
this.$emit("input", value);
|
|
61
226
|
// #endif
|
|
62
227
|
// 触发事件
|
|
63
|
-
this.$emit('change', value)
|
|
228
|
+
this.$emit('change', value);
|
|
229
|
+
},
|
|
230
|
+
onTouchStart(event, index = 1) {
|
|
231
|
+
if (this.disabled) return;
|
|
232
|
+
this.startX = 0;
|
|
233
|
+
// 触摸点集
|
|
234
|
+
let touches = event.touches[0];
|
|
235
|
+
// 触摸点到屏幕左边的距离
|
|
236
|
+
this.startX = touches.clientX;
|
|
237
|
+
// 此处的this.modelValue虽为props值,但是通过$emit('update:modelValue')进行了修改
|
|
238
|
+
if (this.isRange) {
|
|
239
|
+
this.startValue0 = this.format(this.rangeValue[0], 0);
|
|
240
|
+
this.startValue = this.format(this.rangeValue[1], 1);
|
|
241
|
+
} else {
|
|
242
|
+
// #ifdef VUE3
|
|
243
|
+
this.startValue = this.format(this.modelValue);
|
|
244
|
+
// #endif
|
|
245
|
+
// #ifdef VUE2
|
|
246
|
+
this.startValue = this.format(this.value);
|
|
247
|
+
// #endif
|
|
248
|
+
}
|
|
249
|
+
// 标示当前的状态为开始触摸滑动
|
|
250
|
+
this.status = 'start';
|
|
251
|
+
},
|
|
252
|
+
onTouchMove(event, index = 1) {
|
|
253
|
+
if (this.disabled) return;
|
|
254
|
+
// 连续触摸的过程会一直触发本方法,但只有手指触发且移动了才被认为是拖动了,才发出事件
|
|
255
|
+
// 触摸后第一次移动已经将status设置为moving状态,故触摸第二次移动不会触发本事件
|
|
256
|
+
if (this.status == 'start') this.$emit('start');
|
|
257
|
+
let touches = event.touches[0];
|
|
258
|
+
// console.log('touchs', touches)
|
|
259
|
+
// 滑块的左边不一定跟屏幕左边接壤,所以需要减去最外层父元素的左边值
|
|
260
|
+
let clientX = 0;
|
|
261
|
+
// #ifndef APP-NVUE
|
|
262
|
+
clientX = touches.clientX;
|
|
263
|
+
// #endif
|
|
264
|
+
// #ifdef APP-NVUE
|
|
265
|
+
clientX = touches.screenX;
|
|
266
|
+
// #endif
|
|
267
|
+
this.distanceX = clientX - this.sliderRect.left;
|
|
268
|
+
// 获得移动距离对整个滑块的值,此为带有多位小数的值,不能用此更新视图
|
|
269
|
+
// 否则造成通信阻塞,需要每改变一个step值时修改一次视图
|
|
270
|
+
this.newValue = ((this.distanceX / this.sliderRect.width) * (this.max - this.min)) + parseFloat(this.min);
|
|
271
|
+
this.status = 'moving';
|
|
272
|
+
// 发出moving事件
|
|
273
|
+
this.$emit('changing');
|
|
274
|
+
this.updateValue(this.newValue, true, index);
|
|
275
|
+
},
|
|
276
|
+
onTouchEnd(event, index = 1) {
|
|
277
|
+
if (this.disabled) return;
|
|
278
|
+
if (this.status === 'moving') {
|
|
279
|
+
this.updateValue(this.newValue, false, index);
|
|
280
|
+
this.$emit('change');
|
|
281
|
+
}
|
|
282
|
+
this.status = 'end';
|
|
283
|
+
},
|
|
284
|
+
updateValue(value, drag, index = 1) {
|
|
285
|
+
// 去掉小数部分,同时也是对step步进的处理
|
|
286
|
+
let valueFormat = this.format(value, index);
|
|
287
|
+
// 不允许滑动的值超过max最大值
|
|
288
|
+
if(valueFormat > this.max ) {
|
|
289
|
+
valueFormat = this.max
|
|
290
|
+
}
|
|
291
|
+
// 设置移动的距离,不能用百分比,因为NVUE不支持。
|
|
292
|
+
let width = Math.min((valueFormat - this.min) / (this.max - this.min) * this.sliderRect.width, this.sliderRect.width)
|
|
293
|
+
let barStyle = {
|
|
294
|
+
width: width + 'px'
|
|
295
|
+
};
|
|
296
|
+
// 移动期间无需过渡动画
|
|
297
|
+
if (drag == true) {
|
|
298
|
+
barStyle.transition = 'none';
|
|
299
|
+
} else {
|
|
300
|
+
// 非移动期间,删掉对过渡为空的声明,让css中的声明起效
|
|
301
|
+
delete barStyle.transition;
|
|
302
|
+
}
|
|
303
|
+
// 修改value值
|
|
304
|
+
if (this.isRange) {
|
|
305
|
+
this.rangeValue[index] = valueFormat;
|
|
306
|
+
this.$emit("update:modelValue", this.rangeValue);
|
|
307
|
+
} else {
|
|
308
|
+
// #ifdef VUE3
|
|
309
|
+
this.$emit("update:modelValue", valueFormat);
|
|
310
|
+
// #endif
|
|
311
|
+
// #ifdef VUE2
|
|
312
|
+
this.$emit("input", valueFormat);
|
|
313
|
+
// #endif
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
switch (index) {
|
|
317
|
+
case 0:
|
|
318
|
+
this.barStyle0 = {...barStyle};
|
|
319
|
+
break;
|
|
320
|
+
case 1:
|
|
321
|
+
this.barStyle = {...barStyle};
|
|
322
|
+
break;
|
|
323
|
+
default:
|
|
324
|
+
break;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
},
|
|
328
|
+
format(value, index = 1) {
|
|
329
|
+
// 将小数变成整数,为了减少对视图的更新,造成视图层与逻辑层的阻塞
|
|
330
|
+
if (this.isRange) {
|
|
331
|
+
switch (index) {
|
|
332
|
+
case 0:
|
|
333
|
+
return Math.round(
|
|
334
|
+
Math.max(this.min, Math.min(value, this.rangeValue[1] - this.step,this.max))
|
|
335
|
+
/ this.step
|
|
336
|
+
) * this.step;
|
|
337
|
+
break;
|
|
338
|
+
case 1:
|
|
339
|
+
return Math.round(
|
|
340
|
+
Math.max(this.min, this.rangeValue[0] + this.step, Math.min(value, this.max))
|
|
341
|
+
/ this.step
|
|
342
|
+
) * this.step;
|
|
343
|
+
break;
|
|
344
|
+
default:
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
} else {
|
|
348
|
+
return Math.round(
|
|
349
|
+
Math.max(this.min, Math.min(value, this.max))
|
|
350
|
+
/ this.step
|
|
351
|
+
) * this.step;
|
|
352
|
+
}
|
|
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);
|
|
64
359
|
}
|
|
65
|
-
}
|
|
360
|
+
}
|
|
66
361
|
}
|
|
67
362
|
</script>
|
|
68
363
|
|
|
69
364
|
<style lang="scss" scoped>
|
|
70
365
|
@import "../../libs/css/components.scss";
|
|
366
|
+
.u-slider {
|
|
367
|
+
position: relative;
|
|
368
|
+
display: flex;
|
|
369
|
+
flex-direction: row;
|
|
370
|
+
align-items: center;
|
|
371
|
+
|
|
372
|
+
&__native {
|
|
373
|
+
flex: 1;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
&-inner {
|
|
377
|
+
flex: 1;
|
|
378
|
+
position: relative;
|
|
379
|
+
border-radius: 999px;
|
|
380
|
+
padding: 10px 18px;
|
|
381
|
+
justify-content: center;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
&__show-value {
|
|
385
|
+
margin: 10px 18px 10px 0px;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
&__show-range-value {
|
|
389
|
+
padding-top: 2px;
|
|
390
|
+
font-size: 12px;
|
|
391
|
+
line-height: 12px;
|
|
392
|
+
position: absolute;
|
|
393
|
+
bottom: 0;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
&__base {
|
|
397
|
+
background-color: #ebedf0;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/* #ifndef APP-NVUE */
|
|
401
|
+
&-inner:before {
|
|
402
|
+
position: absolute;
|
|
403
|
+
right: 0;
|
|
404
|
+
left: 0;
|
|
405
|
+
content: '';
|
|
406
|
+
top: -8px;
|
|
407
|
+
bottom: -8px;
|
|
408
|
+
z-index: -1;
|
|
409
|
+
}
|
|
410
|
+
/* #endif */
|
|
411
|
+
|
|
412
|
+
&__gap {
|
|
413
|
+
position: relative;
|
|
414
|
+
border-radius: 999px;
|
|
415
|
+
transition: width 0.2s;
|
|
416
|
+
background-color: #1989fa;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
&__button {
|
|
420
|
+
width: 24px;
|
|
421
|
+
height: 24px;
|
|
422
|
+
border-radius: 50%;
|
|
423
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
|
|
424
|
+
background-color: #fff;
|
|
425
|
+
transform: scale(0.9);
|
|
426
|
+
/* #ifdef H5 */
|
|
427
|
+
cursor: pointer;
|
|
428
|
+
/* #endif */
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
&__button-wrap {
|
|
432
|
+
position: absolute;
|
|
433
|
+
// transform: translate3d(50%, -50%, 0);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
&--disabled {
|
|
437
|
+
opacity: 0.5;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
71
440
|
</style>
|
|
@@ -167,12 +167,7 @@ export default {
|
|
|
167
167
|
getContentRef() {
|
|
168
168
|
return this.$refs['u-swipe-action-item__content'].ref
|
|
169
169
|
},
|
|
170
|
-
// #ifdef VUE2
|
|
171
|
-
beforeDestroy() {
|
|
172
|
-
// #endif
|
|
173
|
-
// #ifdef VUE3
|
|
174
170
|
beforeUnmount() {
|
|
175
|
-
// #endif
|
|
176
171
|
this.unbindBindingX()
|
|
177
172
|
}
|
|
178
173
|
}
|
|
@@ -24,7 +24,10 @@
|
|
|
24
24
|
:style="[addStyle(itemStyle), {flex: scrollable ? '' : 1}]"
|
|
25
25
|
:class="[`u-tabs__wrapper__nav__item-${index}`, item.disabled && 'u-tabs__wrapper__nav__item--disabled']"
|
|
26
26
|
>
|
|
27
|
-
<
|
|
27
|
+
<slot v-if="$slots.content" name="content" :item="item" :keyName="keyName" :index="index" />
|
|
28
|
+
<slot v-else-if="!$slots.content && ($slots.default || $slots.$default)"
|
|
29
|
+
:item="item" :keyName="keyName" :index="index" />
|
|
30
|
+
<text v-else
|
|
28
31
|
:class="[item.disabled && 'u-tabs__wrapper__nav__item__text--disabled']"
|
|
29
32
|
class="u-tabs__wrapper__nav__item__text"
|
|
30
33
|
:style="[textStyle(index)]"
|
|
@@ -157,7 +160,7 @@
|
|
|
157
160
|
async mounted() {
|
|
158
161
|
this.init()
|
|
159
162
|
},
|
|
160
|
-
emits: ['click', 'change'],
|
|
163
|
+
emits: ['click', 'change', 'update:current'],
|
|
161
164
|
methods: {
|
|
162
165
|
addStyle,
|
|
163
166
|
addUnit,
|
|
@@ -209,6 +212,7 @@
|
|
|
209
212
|
if (item.disabled) return
|
|
210
213
|
this.innerCurrent = index
|
|
211
214
|
this.resize()
|
|
215
|
+
this.$emit('update:current', index)
|
|
212
216
|
this.$emit('change', {
|
|
213
217
|
...item,
|
|
214
218
|
index
|
|
@@ -327,10 +331,12 @@
|
|
|
327
331
|
@include flex;
|
|
328
332
|
align-items: center;
|
|
329
333
|
justify-content: center;
|
|
334
|
+
/* #ifdef H5 */
|
|
330
335
|
cursor: pointer;
|
|
336
|
+
/* #endif */
|
|
331
337
|
|
|
332
338
|
&--disabled {
|
|
333
|
-
/* #
|
|
339
|
+
/* #ifdef H5 */
|
|
334
340
|
cursor: not-allowed;
|
|
335
341
|
/* #endif */
|
|
336
342
|
}
|
|
@@ -338,7 +344,9 @@
|
|
|
338
344
|
&__text {
|
|
339
345
|
font-size: 15px;
|
|
340
346
|
color: $u-content-color;
|
|
347
|
+
/* #ifndef APP-NVUE */
|
|
341
348
|
white-space: nowrap !important;
|
|
349
|
+
/* #endif */
|
|
342
350
|
|
|
343
351
|
&--disabled {
|
|
344
352
|
color: $u-disabled-color !important;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<view class="u-toast">
|
|
3
3
|
<u-overlay
|
|
4
4
|
:show="isShow"
|
|
5
|
+
:zIndex="tmpConfig.overlay ? 10070 : -1"
|
|
5
6
|
:custom-style="overlayStyle"
|
|
6
7
|
>
|
|
7
8
|
<view
|
|
@@ -54,7 +55,7 @@
|
|
|
54
55
|
* @property {String} icon 图标,或者绝对路径的图片
|
|
55
56
|
* @property {String} type 主题类型 (默认 default)
|
|
56
57
|
* @property {Boolean} show 是否显示该组件 (默认 false)
|
|
57
|
-
* @property {Boolean} overlay 是否显示透明遮罩,防止点击穿透 (默认
|
|
58
|
+
* @property {Boolean} overlay 是否显示透明遮罩,防止点击穿透 (默认 true )
|
|
58
59
|
* @property {String} position 位置 (默认 'center' )
|
|
59
60
|
* @property {Object} params 跳转的参数
|
|
60
61
|
* @property {String | Number} duration 展示时间,单位ms (默认 2000 )
|
|
@@ -80,7 +81,7 @@
|
|
|
80
81
|
icon: true, // 显示的图标
|
|
81
82
|
position: 'center', // toast出现的位置
|
|
82
83
|
complete: null, // 执行完后的回调函数
|
|
83
|
-
overlay:
|
|
84
|
+
overlay: true, // 是否防止触摸穿透
|
|
84
85
|
loading: false, // 是否加载中状态
|
|
85
86
|
},
|
|
86
87
|
tmpConfig: {}, // 将用户配置和内置配置合并后的临时配置变量
|
|
@@ -92,10 +93,14 @@
|
|
|
92
93
|
if(!this.tmpConfig.icon || this.tmpConfig.icon == 'none') {
|
|
93
94
|
return '';
|
|
94
95
|
}
|
|
95
|
-
if (
|
|
96
|
-
|
|
96
|
+
if (this.tmpConfig.icon === true) {
|
|
97
|
+
if (['error', 'warning', 'success', 'primary'].includes(this.tmpConfig.type)) {
|
|
98
|
+
return type2icon(this.tmpConfig.type)
|
|
99
|
+
} else {
|
|
100
|
+
return ''
|
|
101
|
+
}
|
|
97
102
|
} else {
|
|
98
|
-
return
|
|
103
|
+
return this.tmpConfig.icon
|
|
99
104
|
}
|
|
100
105
|
},
|
|
101
106
|
overlayStyle() {
|
|
@@ -178,12 +183,7 @@
|
|
|
178
183
|
this.timer = null
|
|
179
184
|
}
|
|
180
185
|
},
|
|
181
|
-
// #ifdef VUE2
|
|
182
|
-
beforeDestroy() {
|
|
183
|
-
// #endif
|
|
184
|
-
// #ifdef VUE3
|
|
185
186
|
beforeUnmount() {
|
|
186
|
-
// #endif
|
|
187
187
|
this.clearTimer()
|
|
188
188
|
}
|
|
189
189
|
}
|
|
@@ -94,7 +94,13 @@
|
|
|
94
94
|
|
|
95
95
|
<template v-if="isInCount">
|
|
96
96
|
<view
|
|
97
|
-
v-if="$slots.
|
|
97
|
+
v-if="$slots.trigger"
|
|
98
|
+
@tap="chooseFile"
|
|
99
|
+
>
|
|
100
|
+
<slot name="trigger" />
|
|
101
|
+
</view>
|
|
102
|
+
<view
|
|
103
|
+
v-else-if="!$slots.trigger && ($slots.default || $slots.$default)"
|
|
98
104
|
@tap="chooseFile"
|
|
99
105
|
>
|
|
100
106
|
<slot />
|
|
@@ -123,7 +129,6 @@
|
|
|
123
129
|
</view>
|
|
124
130
|
</template>
|
|
125
131
|
</view>
|
|
126
|
-
|
|
127
132
|
</view>
|
|
128
133
|
</template>
|
|
129
134
|
|
|
@@ -332,7 +337,7 @@
|
|
|
332
337
|
});
|
|
333
338
|
},
|
|
334
339
|
onPreviewVideo(event) {
|
|
335
|
-
if (!this.
|
|
340
|
+
if (!this.previewFullImage) return;
|
|
336
341
|
const {
|
|
337
342
|
index
|
|
338
343
|
} = event.currentTarget.dataset;
|
|
@@ -360,7 +365,7 @@
|
|
|
360
365
|
index
|
|
361
366
|
} = event.currentTarget.dataset;
|
|
362
367
|
const item = this.data.lists[index];
|
|
363
|
-
if (!this.
|
|
368
|
+
if (!this.previewFullImage) return;
|
|
364
369
|
switch (item.type) {
|
|
365
370
|
case 'video':
|
|
366
371
|
this.onPreviewVideo(event);
|
|
@@ -19,7 +19,8 @@ function formatImage(res) {
|
|
|
19
19
|
thumb: item.path,
|
|
20
20
|
size: item.size,
|
|
21
21
|
// #ifdef H5
|
|
22
|
-
name: item.name
|
|
22
|
+
name: item.name,
|
|
23
|
+
file: item
|
|
23
24
|
// #endif
|
|
24
25
|
}))
|
|
25
26
|
}
|
|
@@ -33,7 +34,8 @@ function formatVideo(res) {
|
|
|
33
34
|
thumb: res.thumbTempFilePath,
|
|
34
35
|
size: res.size,
|
|
35
36
|
// #ifdef H5
|
|
36
|
-
name: res.name
|
|
37
|
+
name: res.name,
|
|
38
|
+
file: res
|
|
37
39
|
// #endif
|
|
38
40
|
}
|
|
39
41
|
]
|
|
@@ -45,7 +47,10 @@ function formatMedia(res) {
|
|
|
45
47
|
type: res.type,
|
|
46
48
|
url: item.tempFilePath,
|
|
47
49
|
thumb: res.type === 'video' ? item.thumbTempFilePath : item.tempFilePath,
|
|
48
|
-
size: item.size
|
|
50
|
+
size: item.size,
|
|
51
|
+
// #ifdef H5
|
|
52
|
+
file: item
|
|
53
|
+
// #endif
|
|
49
54
|
}))
|
|
50
55
|
}
|
|
51
56
|
|
|
@@ -56,7 +61,8 @@ function formatFile(res) {
|
|
|
56
61
|
size:item.size,
|
|
57
62
|
// #ifdef H5
|
|
58
63
|
name: item.name,
|
|
59
|
-
type: item.type
|
|
64
|
+
type: item.type,
|
|
65
|
+
file: item
|
|
60
66
|
// #endif
|
|
61
67
|
}))
|
|
62
68
|
}
|