support Progress & Upload

support Progress & Upload
This commit is contained in:
梁灏 2017-03-02 14:41:28 +08:00
parent c97c42ab2e
commit 5d08ddf27c
10 changed files with 137 additions and 63 deletions

View file

@ -11,13 +11,14 @@
type="ios-close-empty"
:class="[prefixCls + '-list-remove']"
v-show="file.status === 'finished'"
@click="handleRemove(file)"></Icon>
<Progress
v-if="file.showProgress"
:stroke-width="2"
:percent="parsePercentage(file.percentage)"
:status="file.status === 'finished' && file.showProgress ? 'success' : 'normal'"
transition="fade"></Progress>
@click.native="handleRemove(file)"></Icon>
<transition name="fade">
<Progress
v-if="file.showProgress"
:stroke-width="2"
:percent="parsePercentage(file.percentage)"
:status="file.status === 'finished' && file.showProgress ? 'success' : 'normal'"></Progress>
</transition>
</li>
</ul>
</template>
@ -41,7 +42,6 @@
prefixCls: prefixCls
};
},
computed: {},
methods: {
fileCls (file) {
return [

View file

@ -7,9 +7,9 @@
@dragover.prevent="dragOver = true"
@dragleave.prevent="dragOver = false">
<input
v-el:input
:class="[prefixCls + '-input']"
ref="input"
type="file"
:class="[prefixCls + '-input']"
@change="handleChange"
:multiple="multiple"
:accept="accept">
@ -154,7 +154,7 @@
},
methods: {
handleClick () {
this.$els.input.click();
this.$refs.input.click();
},
handleChange (e) {
const files = e.target.files;
@ -163,7 +163,7 @@
return;
}
this.uploadFiles(files);
this.$els.input.value = null;
this.$refs.input.value = null;
},
onDrop (e) {
this.dragOver = false;
@ -276,7 +276,8 @@
_file.status = 'finished';
_file.response = res;
this.$dispatch('on-form-change', _file);
// todo
// this.$dispatch('on-form-change', _file);
this.onSuccess(res, _file, this.fileList);
setTimeout(() => {