上传组件增加可选择上传途径

This commit is contained in:
aixianling
2022-03-15 10:25:48 +08:00
parent 52ec1ebe41
commit ec803816c9

View File

@@ -55,6 +55,7 @@ export default {
preview: Boolean, preview: Boolean,
size: {default: 10 * 1024 * 1024}, size: {default: 10 * 1024 * 1024},
disabled: Boolean, disabled: Boolean,
sourceType: {default: () => ['album', 'camera']}
}, },
computed: { computed: {
...mapState(['token']), ...mapState(['token']),
@@ -90,7 +91,7 @@ export default {
let params = { let params = {
count: this.limit, count: this.limit,
sizeType: ['compressed'], sizeType: ['compressed'],
sourceType: ['album', 'camera'], sourceType: [this.sourceType].flat(),
success: (res) => { success: (res) => {
let count = this.fileList?.length + (res.tempFiles?.length || res.tempFile ? 1 : 0) let count = this.fileList?.length + (res.tempFiles?.length || res.tempFile ? 1 : 0)
if (count > this.limit && this.limit !== 1) { if (count > this.limit && this.limit !== 1) {