This commit is contained in:
prefert 2020-09-03 15:53:31 +08:00
parent 8f9d3604e6
commit 5bb83ff8e5
258 changed files with 12974 additions and 7838 deletions

View file

@ -13,6 +13,7 @@
:class="[prefixCls + '-input']"
@change="handleChange"
:multiple="multiple"
:webkitdirectory="webkitdirectory"
:accept="accept">
<slot></slot>
</div>
@ -29,12 +30,13 @@
import ajax from './ajax';
import { oneOf } from '../../utils/assist';
import Emitter from '../../mixins/emitter';
import mixinsForm from '../../mixins/form';
const prefixCls = 'ivu-upload';
export default {
name: 'Upload',
mixins: [ Emitter ],
mixins: [ Emitter, mixinsForm ],
components: { UploadList },
props: {
action: {
@ -141,6 +143,10 @@
disabled: {
type: Boolean,
default: false
},
webkitdirectory: {
type: Boolean,
default: false
}
},
data () {
@ -166,7 +172,7 @@
},
methods: {
handleClick () {
if (this.disabled) return;
if (this.itemDisabled) return;
this.$refs.input.click();
},
handleChange (e) {
@ -180,11 +186,11 @@
},
onDrop (e) {
this.dragOver = false;
if (this.disabled) return;
if (this.itemDisabled) return;
this.uploadFiles(e.dataTransfer.files);
},
handlePaste (e) {
if (this.disabled) return;
if (this.itemDisabled) return;
if (this.paste) {
this.uploadFiles(e.clipboardData.files);
}