feat: update upload to 2.6.0
parent
2b3d0a72d9
commit
ef31389965
|
@ -10,6 +10,7 @@ export default {
|
||||||
beforeUpload (file) {
|
beforeUpload (file) {
|
||||||
console.log('beforeUpload', file.name)
|
console.log('beforeUpload', file.name)
|
||||||
},
|
},
|
||||||
|
openFileDialogOnClick: false,
|
||||||
},
|
},
|
||||||
on: {
|
on: {
|
||||||
start (file) {
|
start (file) {
|
||||||
|
@ -24,6 +25,9 @@ export default {
|
||||||
error (err) {
|
error (err) {
|
||||||
console.log('error', err)
|
console.log('error', err)
|
||||||
},
|
},
|
||||||
|
click () {
|
||||||
|
alert('click')
|
||||||
|
},
|
||||||
},
|
},
|
||||||
style: { display: 'inline-block', width: '200px', height: '200px', background: '#eee' },
|
style: { display: 'inline-block', width: '200px', height: '200px', background: '#eee' },
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// rc-upload 2.5.1
|
// rc-upload 2.6.0
|
||||||
import upload from './src'
|
import upload from './src'
|
||||||
|
|
||||||
export default upload
|
export default upload
|
||||||
|
|
|
@ -31,6 +31,7 @@ const upLoadPropTypes = {
|
||||||
customRequest: PropTypes.func,
|
customRequest: PropTypes.func,
|
||||||
// onProgress: PropTypes.func,
|
// onProgress: PropTypes.func,
|
||||||
withCredentials: PropTypes.bool,
|
withCredentials: PropTypes.bool,
|
||||||
|
openFileDialogOnClick: PropTypes.bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
const AjaxUploader = {
|
const AjaxUploader = {
|
||||||
|
@ -184,22 +185,22 @@ const AjaxUploader = {
|
||||||
},
|
},
|
||||||
render () {
|
render () {
|
||||||
const {
|
const {
|
||||||
componentTag: Tag, prefixCls, disabled, multiple, accept, directory,
|
componentTag: Tag, prefixCls, disabled, multiple, accept, directory, openFileDialogOnClick,
|
||||||
} = this.$props
|
} = this.$props
|
||||||
const cls = classNames({
|
const cls = classNames({
|
||||||
[prefixCls]: true,
|
[prefixCls]: true,
|
||||||
[`${prefixCls}-disabled`]: disabled,
|
[`${prefixCls}-disabled`]: disabled,
|
||||||
})
|
})
|
||||||
const events = disabled ? {} : {
|
const events = disabled ? {} : {
|
||||||
click: this.onClick,
|
click: openFileDialogOnClick ? this.onClick : () => {},
|
||||||
keydown: this.onKeyDown,
|
keydown: this.onKeyDown,
|
||||||
drop: this.onFileDrop,
|
drop: this.onFileDrop,
|
||||||
dragover: this.onFileDrop,
|
dragover: this.onFileDrop,
|
||||||
}
|
}
|
||||||
const tagProps = {
|
const tagProps = {
|
||||||
on: {
|
on: {
|
||||||
...events,
|
|
||||||
...this.$listeners,
|
...this.$listeners,
|
||||||
|
...events,
|
||||||
},
|
},
|
||||||
attrs: {
|
attrs: {
|
||||||
role: 'button',
|
role: 'button',
|
||||||
|
|
|
@ -34,6 +34,7 @@ const uploadProps = {
|
||||||
// onReady: PropTypes.func,
|
// onReady: PropTypes.func,
|
||||||
withCredentials: PropTypes.bool,
|
withCredentials: PropTypes.bool,
|
||||||
supportServerRender: PropTypes.bool,
|
supportServerRender: PropTypes.bool,
|
||||||
|
openFileDialogOnClick: PropTypes.bool,
|
||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
name: 'Upload',
|
name: 'Upload',
|
||||||
|
@ -53,6 +54,7 @@ export default {
|
||||||
multiple: false,
|
multiple: false,
|
||||||
beforeUpload: empty,
|
beforeUpload: empty,
|
||||||
withCredentials: false,
|
withCredentials: false,
|
||||||
|
openFileDialogOnClick: true,
|
||||||
}),
|
}),
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue