iview upload自定義上傳列表時的坑
阿新 • • 發佈:2019-02-13
// 這是官方例子
<div class="demo-upload-list" v-for="item in uploadList">
// 這裡有個if判斷 item.status 要等於 finished
<template v-if="item.status === 'finished'"> <img :src="item.url"> <div class="demo-upload-list-cover"> <Icon type="ios-eye-outline" @click.native="handleView(item.name)"></Icon> <Icon type="ios-trash-outline" @click.native="handleRemove(item)"></Icon> </div> </template> <template v-else> <Progress v-if="item.showProgress" :percent="item.percentage" hide-info></Progress> </template> </div>
// 但是這個屬性得手動加上去!!!!!!!
// 比如自己編寫了比如 handleBeforeUpload 函式
// 結束的時候記得給檔案加上 status 屬性 並且設定為 finished 再操作:
file.url = reader.result
file.status = 'finished'
that.uploadList.push(file)