优化加载图片

menu1.0
fanluyan 9 months ago
parent 986efe2314
commit dd95854e88

@ -22,12 +22,16 @@
class="bigPic" class="bigPic"
v-if="currentPicPath.indexOf('nopic') !== -1 && currentPicPath" v-if="currentPicPath.indexOf('nopic') !== -1 && currentPicPath"
> >
<el-image :src="currentPicPath"></el-image> <el-image :src="currentPicPath">
<div slot="placeholder" class="image-slot">
加载中<span class="dot">...</span>
</div>
</el-image>
</div> </div>
<div class="bigPic" v-else-if="currentPicPath && mediaType == 0"> <div class="bigPic" v-else-if="currentPicPath && mediaType == 0">
<!-- :preview-src-list="srcList" @click="handleBigPicbox(currentPicPath)" --> <!-- :preview-src-list="srcList" @click="handleBigPicbox(currentPicPath)" -->
<el-image <el-image
:src="currentPicPath + '!1366x768'" :src="currentPicPath"
@load="loadImage" @load="loadImage"
@error="setDefaultImage" @error="setDefaultImage"
ref="picJpg" ref="picJpg"
@ -36,6 +40,15 @@
height="100%" height="100%"
:preview-src-list="srcList" :preview-src-list="srcList"
> >
<div
slot="placeholder"
class="image-slot"
:style="{
backgroundImage: 'url(' + currentPicPath + '!160x60' + ')',
}"
>
<i class="el-icon-loading"></i>
</div>
<template slot="error"> <template slot="error">
<img src="../../../assets/img/nodatapic2.jpg" /> <img src="../../../assets/img/nodatapic2.jpg" />
</template> </template>
@ -733,9 +746,17 @@ export default {
.el-image { .el-image {
width: 100%; width: 100%;
height: 100%; height: 100%;
.el-image__placeholder {
background: url(../../../assets/img/nopicbg.png) no-repeat center; .image-slot {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
background-size: 100% 100%; background-size: 100% 100%;
i {
font-size: 40px;
color: #128071;
}
} }
img { img {
width: 100%; width: 100%;

Loading…
Cancel
Save