|
|
@@ -85,7 +85,7 @@ const props = defineProps({
|
|
|
|
|
|
})
|
|
|
|
|
|
-const emit = defineEmits(['update:modelValue', 'on-upload-success', 'on-upload-error', 'on-upload-remove'])
|
|
|
+const emit = defineEmits(['update:modelValue', 'on-upload-success', 'on-upload-error', 'on-upload-remove', 'on-upload-local'])
|
|
|
|
|
|
const formContext = inject('formContext', {})
|
|
|
|
|
|
@@ -298,6 +298,10 @@ function beforeDelete (file) {
|
|
|
}
|
|
|
return true
|
|
|
}
|
|
|
+
|
|
|
+function uploadClick () {
|
|
|
+ emit('on-upload-local')
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
@@ -324,7 +328,7 @@ function beforeDelete (file) {
|
|
|
></van-uploader>
|
|
|
|
|
|
<div v-else class="fm-uploader-wrapper">
|
|
|
- <van-uploader
|
|
|
+ <!-- <van-uploader
|
|
|
:max-count="limit"
|
|
|
:disabled="disabled"
|
|
|
:multiple="multiple"
|
|
|
@@ -342,9 +346,12 @@ function beforeDelete (file) {
|
|
|
v-if="!readonly"
|
|
|
>
|
|
|
<van-button icon="plus" type="primary">上传文件</van-button>
|
|
|
- </van-uploader>
|
|
|
+ </van-uploader> -->
|
|
|
+ <span class="fm-uploader-wrapper-badge">{{fileList.length || 0}}</span>
|
|
|
+ <van-button v-if="!readonly" type="primary" @click="uploadClick">{{disabled ? '查看文件' : '上传文件'}}</van-button>
|
|
|
|
|
|
- <div class="fm-uploader-file-list" v-if="!isImage" :class="{'is-readonly': readonly}">
|
|
|
+
|
|
|
+ <!-- <div class="fm-uploader-file-list" v-if="!isImage" :class="{'is-readonly': readonly}">
|
|
|
<van-cell v-for="item in fileList" :key="item.key" class="fm-uploader-file-item">
|
|
|
<template #title>
|
|
|
<van-icon name="file" size="20" />
|
|
|
@@ -362,7 +369,7 @@ function beforeDelete (file) {
|
|
|
/>
|
|
|
</template>
|
|
|
</van-cell>
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
@@ -370,6 +377,21 @@ function beforeDelete (file) {
|
|
|
<style lang="scss" scoped>
|
|
|
.fm-uploader-wrapper{
|
|
|
width: 100%;
|
|
|
+ position: relative;
|
|
|
+}
|
|
|
+.fm-uploader-wrapper-badge {
|
|
|
+ position: absolute;
|
|
|
+ left: 82px;
|
|
|
+ top: -6px;
|
|
|
+ background: red;
|
|
|
+ width: 22px;
|
|
|
+ height: 18px;
|
|
|
+ border-radius: 50%;
|
|
|
+ color: white;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 18px;
|
|
|
+ z-index: 100;
|
|
|
+ font-size: 12px;
|
|
|
}
|
|
|
.fm-uploader-file-list{
|
|
|
margin-top: 10px;
|