|
@@ -68,14 +68,22 @@ export default defineComponent({
|
|
|
if (this.disabled) {
|
|
|
return
|
|
|
}
|
|
|
+ const type = this.uploadType === 'VIDEO' ? 'video' : 'img'
|
|
|
postMessage(
|
|
|
{
|
|
|
api: 'chooseFile',
|
|
|
- content: { type: 'img', max: 1, bucket: this.bucket }
|
|
|
+ content: { type: type, max: 1, bucket: this.bucket }
|
|
|
},
|
|
|
(res: any) => {
|
|
|
console.log(res, 'fileUrl')
|
|
|
- this.$emit('update:modelValue', [...this.modelValue, res.fileUrl])
|
|
|
+ // 判断是否是多选
|
|
|
+ if (this.maxCount > 1) {
|
|
|
+ this.$emit('update:modelValue', [...this.modelValue, res.fileUrl])
|
|
|
+ this.onUploadChange([...this.modelValue, res.fileUrl])
|
|
|
+ } else {
|
|
|
+ this.$emit('update:modelValue', [res.fileUrl])
|
|
|
+ this.onUploadChange([res.fileUrl])
|
|
|
+ }
|
|
|
}
|
|
|
)
|
|
|
},
|
|
@@ -175,8 +183,13 @@ export default defineComponent({
|
|
|
const uploadUrl = getOssUploadUrl(this.bucket) + key
|
|
|
closeToast()
|
|
|
// 判断是否是多选
|
|
|
- this.$emit('update:modelValue', [...this.modelValue, uploadUrl])
|
|
|
- this.onUploadChange([...this.modelValue, uploadUrl])
|
|
|
+ if (this.maxCount > 1) {
|
|
|
+ this.$emit('update:modelValue', [...this.modelValue, uploadUrl])
|
|
|
+ this.onUploadChange([...this.modelValue, uploadUrl])
|
|
|
+ } else {
|
|
|
+ this.$emit('update:modelValue', [uploadUrl])
|
|
|
+ this.onUploadChange([uploadUrl])
|
|
|
+ }
|
|
|
} catch (error) {
|
|
|
console.log(error, 'uploadFile')
|
|
|
}
|
|
@@ -217,6 +230,10 @@ export default defineComponent({
|
|
|
{this.native ? (
|
|
|
this.maxCount > 1 ? (
|
|
|
<div class={[styles.uploader, styles[this.size]]} onClick={this.nativeUpload}>
|
|
|
+ <Icon name={this.uploadIcon} class={['van-uploader__upload']} size="32" />
|
|
|
+ </div>
|
|
|
+ ) : (
|
|
|
+ <div class={[styles.uploader, styles[this.size]]} onClick={this.nativeUpload}>
|
|
|
{this.modelValue.length > 0 ? (
|
|
|
<div class={['van-uploader__upload']}>
|
|
|
{this.modelValue.map((item: any) => (
|
|
@@ -246,10 +263,6 @@ export default defineComponent({
|
|
|
<Icon name={this.uploadIcon} class={['van-uploader__upload']} size="32" />
|
|
|
)}
|
|
|
</div>
|
|
|
- ) : (
|
|
|
- <div class={[styles.uploader, styles[this.size]]} onClick={this.nativeUpload}>
|
|
|
- <Icon name={this.uploadIcon} class={['van-uploader__upload']} size="32" />
|
|
|
- </div>
|
|
|
)
|
|
|
) : this.maxCount > 1 ? (
|
|
|
<Uploader
|