Merge pull request #1815 from SevanNerse/master

options prop is converted to configurations data variable and maxFile…
This commit is contained in:
Cüneyt Şentürk 2021-01-29 15:50:19 +03:00 committed by GitHub
commit f1a7320628
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,6 +86,7 @@ export default {
currentFile: null, currentFile: null,
files: [], files: [],
showList: false, showList: false,
configurations: this.options,
} }
}, },
@ -94,12 +95,12 @@ export default {
let self = this; let self = this;
let preview = !this.multiple ? this.$refs.previewSingle : this.$refs.previewMultiple; let preview = !this.multiple ? this.$refs.previewSingle : this.$refs.previewMultiple;
if (!this.options.maxFiles && !this.multiple) { if (this.configurations.maxFiles === undefined && this.multiple == false) {
this.options['maxFiles'] = 1; this.configurations.maxFiles = 1
} }
let finalOptions = { let finalOptions = {
...this.options, ...self.configurations,
url: this.url, url: this.url,
thumbnailWidth: null, thumbnailWidth: null,
thumbnailHeight: null, thumbnailHeight: null,
@ -111,7 +112,7 @@ export default {
this.on('addedfile', function (file) { this.on('addedfile', function (file) {
self.files.push(file); self.files.push(file);
if (self.options.maxFiles == 1) { if (self.configurations.maxFiles == 1) {
self.$emit('change', file); self.$emit('change', file);
} else { } else {
self.$emit('change', self.files); self.$emit('change', self.files);