style: prettier

This commit is contained in:
tangjinzhou 2019-05-26 13:58:06 +08:00
parent 0a0a6a6103
commit 63fbed0d76
4 changed files with 53 additions and 44 deletions

View File

@ -30,9 +30,11 @@ export default {
},
};
return (
<div style={{
margin: '100px',
}}>
<div
style={{
margin: '100px',
}}
>
<div>
<Upload {...uploaderProps}>
<a>开始上传</a>

View File

@ -28,25 +28,29 @@ export default {
// EXAMPLE: post form-data with 'axios'
const formData = new FormData();
if (data) {
Object
.keys(data)
.map(key => {
formData.append(key, data[key]);
});
Object.keys(data).map(key => {
formData.append(key, data[key]);
});
}
formData.append(filename, file);
axios.post(action, formData, {
withCredentials,
headers,
onUploadProgress: ({total, loaded}) => {
onProgress({
percent: Math.round((loaded / total) * 100).toFixed(2),
}, file);
},
}).then(({data: response}) => {
onSuccess(response, file);
}).catch(onError);
axios
.post(action, formData, {
withCredentials,
headers,
onUploadProgress: ({ total, loaded }) => {
onProgress(
{
percent: Math.round((loaded / total) * 100).toFixed(2),
},
file,
);
},
})
.then(({ data: response }) => {
onSuccess(response, file);
})
.catch(onError);
return {
abort() {
@ -65,17 +69,17 @@ export default {
error(err) {
console.log('error', err);
},
progress({
percent,
}, file) {
progress({ percent }, file) {
console.log('progress', `${percent}%`, file.name);
},
},
};
return (
<div style={{
margin: '100px',
}}>
<div
style={{
margin: '100px',
}}
>
<div>
<Upload {...uploaderProps}>
<a>开始上传</a>

View File

@ -36,6 +36,6 @@ export default {
background: '#eee',
},
};
return <Upload {...uploaderProps}/>;
return <Upload {...uploaderProps} />;
},
};

View File

@ -2,9 +2,9 @@ import Upload from '../index';
export default {
data() {
return {destroyed: false};
return { destroyed: false };
},
methods : {
methods: {
destroy() {
this.destroyed = true;
},
@ -64,15 +64,14 @@ export default {
opacity:0.5;
`;
return (
<div style={{
margin: '100px',
}}>
<div
style={{
margin: '100px',
}}
>
<h2>固定位置</h2>
<style>
{
style
}</style>
<style>{style}</style>
<div>
<Upload {...uploaderProps}>
@ -84,19 +83,23 @@ export default {
<div
style={{
height: '200px',
overflow: 'auto',
border: '1px solid red',
}}>
<div style={{
height: '500px',
}}>
height: '200px',
overflow: 'auto',
border: '1px solid red',
}}
>
<div
style={{
height: '500px',
}}
>
<Upload
{...uploaderProps1}
component="div"
style={{
display: 'inline-block',
}}>
display: 'inline-block',
}}
>
<a>开始上传2</a>
</Upload>
</div>