|
@@ -6,14 +6,15 @@
|
|
|
:on-success="handleUploadSuccess"
|
|
|
:before-upload="handleBeforeUpload"
|
|
|
:limit="limit"
|
|
|
+ :on-preview="handlePreview"
|
|
|
:on-error="handleUploadError"
|
|
|
:on-exceed="handleExceed"
|
|
|
:on-remove="handleRemove"
|
|
|
name="file"
|
|
|
:file-list="fileList"
|
|
|
:headers="headers"
|
|
|
- :class="{hide: this.fileList.length >= this.limit}"
|
|
|
>
|
|
|
+ <div slot="tip" class="el-upload__tip">cad文件类型:dwg,dwt;word文件类型:doc,docx;Excel文件类型:xls,xlsx;照片文件类型:jpg,png,jpeg</div>
|
|
|
<i class="el-icon-plus abs"></i>
|
|
|
</el-upload>
|
|
|
|
|
@@ -28,7 +29,7 @@
|
|
|
<!-- <transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">-->
|
|
|
<!-- <li :key="file.url + index" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">-->
|
|
|
<!-- <el-link :href="`${file.url}`" :underline="false" target="_blank">-->
|
|
|
-<!-- <span class="el-icon-document"> {{ file.fileName }} </span>-->
|
|
|
+<!-- <span class="el-icon-document"> {{ file.name }} </span>-->
|
|
|
<!-- </el-link>-->
|
|
|
<!-- <div class="ele-upload-list__item-content-action">-->
|
|
|
<!-- <el-link :underline="false" @click="handleDelete(index)" type="danger">删除</el-link>-->
|
|
@@ -90,7 +91,6 @@ export default {
|
|
|
value: {
|
|
|
handler(val) {
|
|
|
if (val) {
|
|
|
- debugger
|
|
|
// 首先将值转为数组
|
|
|
const list = Array.isArray(val) ? val : this.value.split(',');
|
|
|
// 然后将数组转为对象数组
|
|
@@ -116,6 +116,13 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
+ handlePreview(file){
|
|
|
+ if (file.url==null)return;
|
|
|
+ const link = document.createElement('a');
|
|
|
+ link.href = file.url;
|
|
|
+ link.download = file.name?file.name:'文件'; // 可以指定下载后的文件名
|
|
|
+ link.click();
|
|
|
+ },
|
|
|
// 删除文件
|
|
|
handleDelete(index) {
|
|
|
const obj = this.fileList[index];
|