2019-01-12 03:33:27 +00:00
|
|
|
import Upload from '../index';
|
2018-04-12 06:37:22 +00:00
|
|
|
|
|
|
|
export default {
|
2019-01-12 03:33:27 +00:00
|
|
|
render() {
|
2018-04-12 06:37:22 +00:00
|
|
|
const uploaderProps = {
|
|
|
|
props: {
|
2018-09-05 13:28:54 +00:00
|
|
|
action: '//jsonplaceholder.typicode.com/posts/',
|
2018-04-12 06:37:22 +00:00
|
|
|
type: 'drag',
|
|
|
|
accept: '.png',
|
2019-01-12 03:33:27 +00:00
|
|
|
beforeUpload(file) {
|
|
|
|
console.log('beforeUpload', file.name);
|
2018-04-12 06:37:22 +00:00
|
|
|
},
|
2018-10-31 11:06:21 +00:00
|
|
|
openFileDialogOnClick: false,
|
2018-04-12 06:37:22 +00:00
|
|
|
},
|
|
|
|
on: {
|
2019-01-12 03:33:27 +00:00
|
|
|
start(file) {
|
|
|
|
console.log('start', file, file.name);
|
2018-04-12 06:37:22 +00:00
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
success(file) {
|
|
|
|
console.log('success', file);
|
2018-04-12 06:37:22 +00:00
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
progress(step, file) {
|
|
|
|
console.log('progress', Math.round(step.percent), file.name);
|
2018-04-12 06:37:22 +00:00
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
error(err) {
|
|
|
|
console.log('error', err);
|
2018-04-12 06:37:22 +00:00
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
click() {
|
|
|
|
alert('click');
|
2018-10-31 11:06:21 +00:00
|
|
|
},
|
2018-04-12 06:37:22 +00:00
|
|
|
},
|
|
|
|
style: { display: 'inline-block', width: '200px', height: '200px', background: '#eee' },
|
2019-01-12 03:33:27 +00:00
|
|
|
};
|
|
|
|
return <Upload {...uploaderProps} />;
|
2018-04-12 06:37:22 +00:00
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
};
|