feat: update upload to 2.6.0

pull/309/head
wangxueliang 2018-10-31 19:06:21 +08:00
parent 2b3d0a72d9
commit ef31389965
4 changed files with 11 additions and 4 deletions

View File

@ -10,6 +10,7 @@ export default {
beforeUpload (file) {
console.log('beforeUpload', file.name)
},
openFileDialogOnClick: false,
},
on: {
start (file) {
@ -24,6 +25,9 @@ export default {
error (err) {
console.log('error', err)
},
click () {
alert('click')
},
},
style: { display: 'inline-block', width: '200px', height: '200px', background: '#eee' },
}

View File

@ -1,4 +1,4 @@
// rc-upload 2.5.1
// rc-upload 2.6.0
import upload from './src'
export default upload

View File

@ -31,6 +31,7 @@ const upLoadPropTypes = {
customRequest: PropTypes.func,
// onProgress: PropTypes.func,
withCredentials: PropTypes.bool,
openFileDialogOnClick: PropTypes.bool,
}
const AjaxUploader = {
@ -184,22 +185,22 @@ const AjaxUploader = {
},
render () {
const {
componentTag: Tag, prefixCls, disabled, multiple, accept, directory,
componentTag: Tag, prefixCls, disabled, multiple, accept, directory, openFileDialogOnClick,
} = this.$props
const cls = classNames({
[prefixCls]: true,
[`${prefixCls}-disabled`]: disabled,
})
const events = disabled ? {} : {
click: this.onClick,
click: openFileDialogOnClick ? this.onClick : () => {},
keydown: this.onKeyDown,
drop: this.onFileDrop,
dragover: this.onFileDrop,
}
const tagProps = {
on: {
...events,
...this.$listeners,
...events,
},
attrs: {
role: 'button',

View File

@ -34,6 +34,7 @@ const uploadProps = {
// onReady: PropTypes.func,
withCredentials: PropTypes.bool,
supportServerRender: PropTypes.bool,
openFileDialogOnClick: PropTypes.bool,
}
export default {
name: 'Upload',
@ -53,6 +54,7 @@ export default {
multiple: false,
beforeUpload: empty,
withCredentials: false,
openFileDialogOnClick: true,
}),
data () {
return {