Commit 7839bba1 authored by 赵啸非's avatar 赵啸非

添加附件显示

parent e0bf4d38
...@@ -28,8 +28,12 @@ ...@@ -28,8 +28,12 @@
<el-divider style="width: 100%"></el-divider> <el-divider style="width: 100%"></el-divider>
<el-link type="primary" :href="form.filePath" >{{form.fileName}}</el-link> <div v-if="isImage">
<img :src="form.filePath" alt="图片描述">
</div>
<div v-else>
<el-link type="primary" :href="form.filePath" >{{form.fileName}}</el-link>
</div>
</el-card> </el-card>
</el-col> </el-col>
</el-row> </el-row>
...@@ -44,10 +48,21 @@ ...@@ -44,10 +48,21 @@
components: { components: {
}, },
methods: { methods: {
afterRender(data) {
this.checkFileType()
},
checkFileType() {
const extension = this.form.fileName.split('.').pop().toLowerCase();
if (['jpg', 'jpeg', 'png', 'gif'].indexOf(extension) !== -1) {
this.isImage = true;
} else {
this.isImage = false;
}
},
}, },
data() { data() {
return { return {
isImage: false,
size:"small", size:"small",
column:2, column:2,
toString:[ toString:[
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment