feat: vc-upload to 2.6.2

pull/666/head
wangxueliang 2019-02-18 23:33:39 +08:00
parent 9e9339c3b3
commit a10711d9ae
5 changed files with 37 additions and 15 deletions

View File

@ -1,10 +1,10 @@
<script>
import Simple from '../vc-upload/demo/simple';
import Drag from '../vc-upload/demo/drag';
import AsyncAction from '../vc-upload/demo/asyncAction';
import BeforeUpload from '../vc-upload/demo/beforeUpload';
import CustomRequest from '../vc-upload/demo/customRequest';
import DirectoryUpload from '../vc-upload/demo/directoryUpload';
import Simple from './simple';
import Drag from './drag';
import AsyncAction from './asyncAction';
import BeforeUpload from './beforeUpload';
import CustomRequest from './customRequest';
import DirectoryUpload from './directoryUpload';
export default {
render () {

View File

@ -92,10 +92,11 @@ export default {
height: '500px',
}}
>
<Upload {...uploaderProps1} component="div" style={{ display: 'inline-block' }}>
<Upload {...uploaderProps1} id="test" component="div" style={{ display: 'inline-block' }}>
<a>开始上传2</a>
</Upload>
</div>
<label for="test">Label for Upload</label>
</div>
<button onClick={this.destroy}>destroy</button>

View File

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

View File

@ -1,3 +1,26 @@
function loopFiles(item, callback) {
const dirReader = item.createReader();
let fileList = [];
function sequence() {
dirReader.readEntries((entries) => {
const entryList = Array.prototype.slice.apply(entries);
fileList = fileList.concat(entryList);
// Check if all the file has been viewed
const isFinished = !entryList.length;
if (isFinished) {
callback(fileList);
} else {
sequence();
}
});
}
sequence();
}
const traverseFileTree = (files, callback, isAccepted) => {
const _traverseFileTree = (item, path) => {
path = path || '';
@ -8,12 +31,10 @@ const traverseFileTree = (files, callback, isAccepted) => {
}
});
} else if (item.isDirectory) {
const dirReader = item.createReader();
dirReader.readEntries(entries => {
for (const entrieItem of entries) {
_traverseFileTree(entrieItem, `${path}${item.name}/`);
}
loopFiles(item, (entries) => {
entries.forEach((entryItem) => {
_traverseFileTree(entryItem, `${path}${item.name}/`);
});
});
}
};

View File

@ -12,7 +12,7 @@ import Api from './components/api';
import './components';
import demoBox from './components/demoBox';
import demoContainer from './components/demoContainer';
import Test from '../components/form/demo/index.vue';
import Test from '../components/test/index.vue';
import zhCN from './theme/zh-CN';
import enUS from './theme/en-US';
Vue.use(Vuex);