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.
@@ -6,7 +6,6 @@
6
6
  ></u-status-bar>
7
7
  <view
8
8
  class="u-navbar-mini__content"
9
- :class="[border && 'u-border-bottom']"
10
9
  :style="{
11
10
  height: addUnit(height),
12
11
  backgroundColor: bgColor,
@@ -5,6 +5,11 @@ export const props = defineMixin({
5
5
  bgColor: {
6
6
  type: String,
7
7
  default: () => defProps.statusBar.bgColor
8
- }
8
+ },
9
+ // 状态栏获取得高度
10
+ height: {
11
+ type: Number,
12
+ default: () => defProps.statusBar.height
13
+ }
9
14
  }
10
15
  })
@@ -10,6 +10,7 @@
10
10
  export default {
11
11
  // statusBar
12
12
  statusBar: {
13
- bgColor: 'transparent'
13
+ bgColor: 'transparent',
14
+ height: 0
14
15
  }
15
16
  }
@@ -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
- <text
36
- class="u-tag__text"
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
- </text>
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
- if (this.accept === 'video' || test.video(result)) {
497
- thumb = result + '?x-oss-process=video/snapshot,t_10000,m_fast';
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: (r) => {
521
- result = res0.data.params.host + '/' + res0.data.params.key;
522
- that.succcessUpload(len + j, result);
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) => {
@@ -39,6 +39,7 @@ export default {
39
39
  autoUploadAuthUrl: '',
40
40
  autoUploadDriver: '',
41
41
  autoUploadHeader: {},
42
- getVideoThumb: false
42
+ getVideoThumb: false,
43
+ customAfterAutoUpload: false
43
44
  }
44
45
  }
package/index.js CHANGED
@@ -84,7 +84,15 @@ export const mount$u = function() {
84
84
  uni.$u = $u
85
85
  }
86
86
 
87
- // #ifdef H5
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
@@ -2,7 +2,7 @@
2
2
  "id": "uview-plus",
3
3
  "name": "uview-plus",
4
4
  "displayName": "零云®uview-plus3.0重磅发布,全面的Vue3鸿蒙移动组件库。",
5
- "version": "3.4.19",
5
+ "version": "3.4.20",
6
6
  "description": "零云®uview-plus已兼容vue3,全面的组件和便捷的工具会让您信手拈来,如鱼得水。",
7
7
  "keywords": [
8
8
  "uview",