refs #1317 Open link when it is clicked on preview

This commit is contained in:
AkiraFukushima 2020-05-07 23:28:48 +09:00
parent 681bd3b2b1
commit 2d85190038
1 changed files with 23 additions and 5 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="link"> <div class="link" @click="openLink(url)">
<el-image :src="icon" class="icon" :fit="cover" lazy> <el-image :src="icon" class="icon" fit="cover" lazy>
<div class="image-slot" slot="error"> <div class="image-slot" slot="error">
<i class="el-icon-link"></i> <i class="el-icon-link"></i>
</div> </div>
@ -30,7 +30,14 @@ export default {
}, },
url: { url: {
type: String, type: String,
default: '' default: null
}
},
methods: {
openLink(link) {
if (link) {
return window.shell.openExternal(link)
}
} }
} }
} }
@ -43,10 +50,17 @@ export default {
overflow: hidden; overflow: hidden;
margin-bottom: 4px; margin-bottom: 4px;
border: 1px solid var(--theme-selected-background-color); border: 1px solid var(--theme-selected-background-color);
cursor: pointer;
&:hover {
background-color: var(--theme-selected-background-color);
}
.icon { .icon {
width: 60px; width: 60px;
height: 60px; height: 60px;
min-width: 60px;
min-height: 60px;
.image-slot { .image-slot {
font-size: 24px; font-size: 24px;
@ -64,15 +78,19 @@ export default {
box-sizing: border-box; box-sizing: border-box;
height: 60px; height: 60px;
padding: 4px 0 0 10px; padding: 4px 0 0 10px;
color: #909399; color: var(--theme-secondary-color);
strong { strong {
display: block; display: block;
text-overflow: ellipsis;
} }
span { span {
display: block; display: inline;
padding: 4px 0; padding: 4px 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
} }
} }
} }