ant-design-vue/components/vc-upload/demo/drag.jsx

42 lines
963 B
Vue
Raw Normal View History

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: {
2019-05-25 10:24:22 +00:00
action: 'https://www.mocky.io/v2/5cc8019d300000980a055e76',
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
},
2019-05-25 10:24:22 +00:00
style: {
display: 'inline-block',
width: '200px',
height: '200px',
background: '#eee',
},
2019-01-12 03:33:27 +00:00
};
2019-05-26 05:58:06 +00:00
return <Upload {...uploaderProps} />;
2018-04-12 06:37:22 +00:00
},
2019-01-12 03:33:27 +00:00
};