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> <script>
import Simple from '../vc-upload/demo/simple'; import Simple from './simple';
import Drag from '../vc-upload/demo/drag'; import Drag from './drag';
import AsyncAction from '../vc-upload/demo/asyncAction'; import AsyncAction from './asyncAction';
import BeforeUpload from '../vc-upload/demo/beforeUpload'; import BeforeUpload from './beforeUpload';
import CustomRequest from '../vc-upload/demo/customRequest'; import CustomRequest from './customRequest';
import DirectoryUpload from '../vc-upload/demo/directoryUpload'; import DirectoryUpload from './directoryUpload';
export default { export default {
render () { render () {

View File

@ -92,10 +92,11 @@ export default {
height: '500px', height: '500px',
}} }}
> >
<Upload {...uploaderProps1} component="div" style={{ display: 'inline-block' }}> <Upload {...uploaderProps1} id="test" component="div" style={{ display: 'inline-block' }}>
<a>开始上传2</a> <a>开始上传2</a>
</Upload> </Upload>
</div> </div>
<label for="test">Label for Upload</label>
</div> </div>
<button onClick={this.destroy}>destroy</button> <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'; import upload from './src';
export default upload; 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 = (files, callback, isAccepted) => {
const _traverseFileTree = (item, path) => { const _traverseFileTree = (item, path) => {
path = path || ''; path = path || '';
@ -8,12 +31,10 @@ const traverseFileTree = (files, callback, isAccepted) => {
} }
}); });
} else if (item.isDirectory) { } else if (item.isDirectory) {
const dirReader = item.createReader(); loopFiles(item, (entries) => {
entries.forEach((entryItem) => {
dirReader.readEntries(entries => { _traverseFileTree(entryItem, `${path}${item.name}/`);
for (const entrieItem of entries) { });
_traverseFileTree(entrieItem, `${path}${item.name}/`);
}
}); });
} }
}; };

View File

@ -12,7 +12,7 @@ import Api from './components/api';
import './components'; import './components';
import demoBox from './components/demoBox'; import demoBox from './components/demoBox';
import demoContainer from './components/demoContainer'; 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 zhCN from './theme/zh-CN';
import enUS from './theme/en-US'; import enUS from './theme/en-US';
Vue.use(Vuex); Vue.use(Vuex);