im-ui-mobile 0.1.18 → 0.1.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.
@@ -45,7 +45,7 @@
45
45
  </template>
46
46
 
47
47
  <script setup lang="ts">
48
- import { ref, computed, watch, nextTick, useSlots } from 'vue'
48
+ import { ref, computed, watch } from 'vue'
49
49
  import ImCell from '../im-cell/im-cell.vue'
50
50
 
51
51
  // 定义 Props 接口
@@ -51,9 +51,9 @@
51
51
  </view>
52
52
 
53
53
  <!-- 文件列表 -->
54
- <view v-if="showList && fileList.length > 0" class="im-upload__list">
55
- <view v-for="(file, index) in fileList" :key="file.uid" class="im-upload__item"
56
- :class="`im-upload__item--${listType}`">
54
+ <view class="im-upload__list">
55
+ <view v-if="showList && fileList.length > 0" v-for="(file, index) in fileList" :key="file.uid"
56
+ class="im-upload__item" :class="`im-upload__item--${listType}`">
57
57
  <!-- 图片列表 -->
58
58
  <template v-if="listType === 'picture'">
59
59
  <view class="im-upload__item-preview">
@@ -121,6 +121,10 @@
121
121
  </view>
122
122
  </template>
123
123
  </view>
124
+
125
+ <view v-if="!type" class="im-upload__default" @tap="handleUploadTap">
126
+ <im-icon type="custom" name="+" customClass="im-upload__default-icon" />
127
+ </view>
124
128
  </view>
125
129
 
126
130
  <!-- 上传提示 -->
@@ -297,7 +301,7 @@ const props = withDefaults(defineProps<Props>(), {
297
301
  }
298
302
  },
299
303
 
300
- showList: false,
304
+ showList: true,
301
305
  listType: 'picture',
302
306
  removable: true,
303
307
  previewable: true,
@@ -519,6 +523,11 @@ const startUpload = async (uploadFile: UploadFile) => {
519
523
  throw new Error('请设置上传地址或自定义上传函数')
520
524
  }
521
525
 
526
+ // 服务端失败
527
+ if (response.statusCode !== 200) {
528
+ throw new Error(response.data.error.message)
529
+ }
530
+
522
531
  // 格式化响应数据
523
532
  const formattedResponse = props.responseFormatter(response)
524
533
 
@@ -746,6 +755,26 @@ defineExpose({
746
755
  font-size: 28rpx;
747
756
  }
748
757
 
758
+ .im-upload__default {
759
+ margin-top: 20rpx;
760
+ display: flex;
761
+ align-items: center;
762
+ justify-content: center;
763
+ width: 180rpx;
764
+ height: 180rpx;
765
+ border: 4rpx dashed #dcdfe6;
766
+ border-radius: 20rpx;
767
+ background-color: #fafafa;
768
+ transition: all 0.3s;
769
+
770
+ &-icon {
771
+ color: #dcdfe6;
772
+ font-size: 200rpx;
773
+ margin-top: -20rpx;
774
+ }
775
+ }
776
+
777
+
749
778
  .im-upload__card {
750
779
  display: flex;
751
780
  flex-direction: column;
@@ -851,8 +880,8 @@ defineExpose({
851
880
 
852
881
  .im-upload__item-preview {
853
882
  position: relative;
854
- width: 200rpx;
855
- height: 200rpx;
883
+ width: 184rpx;
884
+ height: 184rpx;
856
885
  border-radius: 8rpx;
857
886
  overflow: hidden;
858
887
  border: 1rpx solid #ebeef5;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "im-ui-mobile",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "A Vue3.0 + Typescript instant messaging component library for Uniapp",
5
5
  "type": "module",
6
6
  "main": "index.js",