qianlishi 2 years ago
parent 118eb6ab1f
commit 0c569c03c1

@ -6,23 +6,16 @@
:action="requestUrl" :action="requestUrl"
list-type="picture-card" list-type="picture-card"
:file-list="fileList" :file-list="fileList"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove" :on-remove="handleRemove"
:on-exceed="handleExceed"
:on-success="handleSuccess" :on-success="handleSuccess"
:show-file-list="true" :show-file-list="true"
:before-upload="handleBeforeUpload" :before-upload="handleBeforeUpload"
:class="fileList && fileList.length >= limit ? 'hide_box' : ''"
> >
<i slot="default" class="el-icon-plus" /> <i slot="default" class="el-icon-plus" />
<div slot="file" slot-scope="{ file }" class="imgBox"> <div slot="file" slot-scope="{ file }" class="imgBox">
<img class="el-upload-list__item-thumbnail" :src="file.url" alt="" /> <img class="el-upload-list__item-thumbnail" :src="file.url" alt="" />
<span class="el-upload-list__item-actions"> <span class="el-upload-list__item-actions">
<span
class="el-upload-list__item-preview"
@click="handlePictureCardPreview(file)"
>
<i class="el-icon-zoom-in" />
</span>
<span <span
class="el-upload-list__item-delete" class="el-upload-list__item-delete"
@click="handleDownload(file)" @click="handleDownload(file)"
@ -35,9 +28,6 @@
</span> </span>
</div> </div>
</el-upload> </el-upload>
<el-dialog :visible.sync="dialogVisibleImageUpload" :modal="false">
<img width="100%" :src="imageUploadUrl" alt="" />
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
@ -69,7 +59,6 @@ export default {
data() { data() {
return { return {
imageUploadUrl: "", imageUploadUrl: "",
dialogVisibleImageUpload: false,
fileList: [], fileList: [],
modeString: "" modeString: ""
}; };
@ -98,18 +87,13 @@ export default {
}, },
methods: { methods: {
handleRemove(file) { handleRemove(file) {
const fileList = []; this.fileList = [];
this.fileList.forEach(el => { console.log(this.fileList);
if (el.fileId != file.fileId) { console.log(this.limit);
fileList.push(el);
}
});
this.fileList = fileList;
this.change(); this.change();
}, },
handlePictureCardPreview(file) { handleExceed() {
this.imageUploadUrl = file.url; this.$message.warning(`只能上传${this.limit}个文件`);
this.dialogVisibleImageUpload = true;
}, },
// //
handleDownload(file) { handleDownload(file) {

Loading…
Cancel
Save