uview-plus 3.4.19 → 3.4.20
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/components/u-navbar-mini/u-navbar-mini.vue +0 -1
- package/components/u-status-bar/props.js +6 -1
- package/components/u-status-bar/statusBar.js +2 -1
- package/components/u-status-bar/u-status-bar.vue +2 -0
- package/components/u-tag/u-tag.vue +22 -8
- package/components/u-upload/props.js +5 -0
- package/components/u-upload/u-upload.vue +49 -8
- package/components/u-upload/upload.js +2 -1
- package/index.js +13 -10
- package/package.json +1 -1
|
@@ -34,11 +34,13 @@
|
|
|
34
34
|
this.isH5 = true
|
|
35
35
|
// #endif
|
|
36
36
|
},
|
|
37
|
+
emits: ['update:height'],
|
|
37
38
|
computed: {
|
|
38
39
|
style() {
|
|
39
40
|
const style = {}
|
|
40
41
|
// 状态栏高度,由于某些安卓和微信开发工具无法识别css的顶部状态栏变量,所以使用js获取的方式
|
|
41
42
|
let sheight = getWindowInfo().statusBarHeight
|
|
43
|
+
this.$emit('update:height', sheight)
|
|
42
44
|
if (sheight == 0) {
|
|
43
45
|
this.isH5 = true
|
|
44
46
|
} else {
|
|
@@ -32,15 +32,29 @@
|
|
|
32
32
|
></u-icon>
|
|
33
33
|
</view>
|
|
34
34
|
</slot>
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
:style="[textColor]"
|
|
38
|
-
:class="[`u-tag__text--${type}`, plain && `u-tag__text--${type}--plain`, `u-tag__text--${size}`]"
|
|
39
|
-
>
|
|
40
|
-
<slot>
|
|
41
|
-
{{ text }}
|
|
35
|
+
<view class="u-tag__content">
|
|
36
|
+
<slot name="content">
|
|
42
37
|
</slot>
|
|
43
|
-
|
|
38
|
+
<template v-if="!$slots.content">
|
|
39
|
+
<text
|
|
40
|
+
v-if="!$slots.default && !$slots.$default"
|
|
41
|
+
class="u-tag__text"
|
|
42
|
+
:style="[textColor]"
|
|
43
|
+
:class="[`u-tag__text--${type}`, plain && `u-tag__text--${type}--plain`, `u-tag__text--${size}`]"
|
|
44
|
+
>
|
|
45
|
+
{{ text }}
|
|
46
|
+
</text>
|
|
47
|
+
<text
|
|
48
|
+
v-else
|
|
49
|
+
class="u-tag__text"
|
|
50
|
+
:style="[textColor]"
|
|
51
|
+
:class="[`u-tag__text--${type}`, plain && `u-tag__text--${type}--plain`, `u-tag__text--${size}`]"
|
|
52
|
+
>
|
|
53
|
+
<slot>
|
|
54
|
+
</slot>
|
|
55
|
+
</text>
|
|
56
|
+
</template>
|
|
57
|
+
</view>
|
|
44
58
|
</view>
|
|
45
59
|
<view
|
|
46
60
|
class="u-tag__close"
|
|
@@ -163,5 +163,10 @@ export const props = defineMixin({
|
|
|
163
163
|
type: Boolean,
|
|
164
164
|
default: () => defProps.upload.getVideoThumb
|
|
165
165
|
},
|
|
166
|
+
// 自定义自动上传后处理
|
|
167
|
+
customAfterAutoUpload: {
|
|
168
|
+
type: Boolean,
|
|
169
|
+
default: () => defProps.upload.customAfterAutoUpload
|
|
170
|
+
},
|
|
166
171
|
}
|
|
167
172
|
})
|
|
@@ -263,7 +263,7 @@
|
|
|
263
263
|
}
|
|
264
264
|
},
|
|
265
265
|
// #ifdef VUE3
|
|
266
|
-
emits: ['error', 'beforeRead', 'oversize', 'afterRead', 'delete', 'clickPreview', 'update:fileList'],
|
|
266
|
+
emits: ['error', 'beforeRead', 'oversize', 'afterRead', 'delete', 'clickPreview', 'update:fileList', 'afterAutoUpload'],
|
|
267
267
|
// #endif
|
|
268
268
|
methods: {
|
|
269
269
|
addUnit,
|
|
@@ -491,12 +491,29 @@
|
|
|
491
491
|
// header: header,
|
|
492
492
|
formData: formData,
|
|
493
493
|
success: (uploadFileRes) => {
|
|
494
|
-
result = res0.data.params.host + '/' + res0.data.params.key;
|
|
495
494
|
let thumb = '';
|
|
496
|
-
|
|
497
|
-
|
|
495
|
+
let afterPromise = '';
|
|
496
|
+
if (that.customAfterAutoUpload) {
|
|
497
|
+
afterPromise = new Promise((resolve, reject) => {
|
|
498
|
+
that.$emit(
|
|
499
|
+
'afterAutoUpload',
|
|
500
|
+
Object.assign(res0, {
|
|
501
|
+
callback: (r) => {
|
|
502
|
+
r.url ? resolve(r) : reject();
|
|
503
|
+
},
|
|
504
|
+
})
|
|
505
|
+
);
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
if (test.promise(afterPromise)) {
|
|
509
|
+
afterPromise.then((data) => that.succcessUpload(len + j, data.url, data.thumb));
|
|
510
|
+
} else {
|
|
511
|
+
result = res0.data.params.host + '/' + res0.data.params.key;
|
|
512
|
+
if (that.accept === 'video' || test.video(result)) {
|
|
513
|
+
thumb = result + '?x-oss-process=video/snapshot,t_10000,m_fast';
|
|
514
|
+
}
|
|
515
|
+
that.succcessUpload(len + j, result, thumb);
|
|
498
516
|
}
|
|
499
|
-
that.succcessUpload(len + j, result, thumb);
|
|
500
517
|
}
|
|
501
518
|
});
|
|
502
519
|
uploadTask.onProgressUpdate((res) => {
|
|
@@ -517,9 +534,33 @@
|
|
|
517
534
|
name: 'file',
|
|
518
535
|
// fileType: 'video', // 仅支付宝小程序,且必填。
|
|
519
536
|
header: this.autoUploadHeader,
|
|
520
|
-
success: (
|
|
521
|
-
|
|
522
|
-
|
|
537
|
+
success: (uploadFileRes) => {
|
|
538
|
+
let res0 = uploadFileRes.data;
|
|
539
|
+
let afterPromise = '';
|
|
540
|
+
if (that.customAfterAutoUpload) {
|
|
541
|
+
afterPromise = new Promise((resolve, reject) => {
|
|
542
|
+
that.$emit(
|
|
543
|
+
'afterAutoUpload',
|
|
544
|
+
Object.assign(res0, {
|
|
545
|
+
callback: (r) => {
|
|
546
|
+
r.url ? resolve(r) : reject();
|
|
547
|
+
}
|
|
548
|
+
})
|
|
549
|
+
);
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
if (test.promise(afterPromise)) {
|
|
553
|
+
afterPromise.then((data) => that.succcessUpload(len + j, data.url));
|
|
554
|
+
} else {
|
|
555
|
+
if (res0.code != 200) {
|
|
556
|
+
uni.showToast({
|
|
557
|
+
title: res0.msg
|
|
558
|
+
});
|
|
559
|
+
} else {
|
|
560
|
+
result = res0.data.url;
|
|
561
|
+
that.succcessUpload(len + j, result);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
523
564
|
}
|
|
524
565
|
});
|
|
525
566
|
uploadTask.onProgressUpdate((res) => {
|
package/index.js
CHANGED
|
@@ -84,7 +84,15 @@ export const mount$u = function() {
|
|
|
84
84
|
uni.$u = $u
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
function toCamelCase(str) {
|
|
88
|
+
return str.replace(/-([a-z])/g, function(match, group1) {
|
|
89
|
+
return group1.toUpperCase();
|
|
90
|
+
}).replace(/^[a-z]/, function(match) {
|
|
91
|
+
return match.toUpperCase();
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// #ifdef APP || H5
|
|
88
96
|
const importFn = import.meta.glob('./components/u-*/u-*.vue', { eager: true })
|
|
89
97
|
let components = [];
|
|
90
98
|
|
|
@@ -102,18 +110,13 @@ for (const key in importFn) {
|
|
|
102
110
|
}
|
|
103
111
|
// #endif
|
|
104
112
|
|
|
105
|
-
function toCamelCase(str) {
|
|
106
|
-
return str.replace(/-([a-z])/g, function(match, group1) {
|
|
107
|
-
return group1.toUpperCase();
|
|
108
|
-
}).replace(/^[a-z]/, function(match) {
|
|
109
|
-
return match.toUpperCase();
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
|
|
113
113
|
const install = (Vue, upuiParams = '') => {
|
|
114
|
-
// #ifdef H5
|
|
114
|
+
// #ifdef APP || H5
|
|
115
115
|
components.forEach(function(component) {
|
|
116
116
|
const name = component.name.replace(/u-([a-zA-Z0-9-_]+)/g, 'up-$1');
|
|
117
|
+
if (name != component.name) {
|
|
118
|
+
Vue.component(component.name, component);
|
|
119
|
+
}
|
|
117
120
|
Vue.component(name, component);
|
|
118
121
|
});
|
|
119
122
|
// #endif
|
package/package.json
CHANGED