图片懒加载

This commit is contained in:
yanran200730
2022-06-01 09:56:07 +08:00
parent 3484a05d00
commit 8511ba81ea
5 changed files with 10 additions and 32 deletions

View File

@@ -55,7 +55,7 @@
<div class="item" v-for="(item, index) in list" :key="index" @click="linkTo('./AlbumDetail?id=' + item.id)">
<span v-if="item.photoHasRead === 'NO'">未查看</span>
<image src="./../images/icon.png" v-if="!item.lastPhotoUrl" />
<image class="item-img" :src="item.lastPhotoUrl" v-else />
<u-lazy-load class="item-img" :image="item.lastPhotoUrl" v-else img-mode="aspectFill"></u-lazy-load>
<div class="item-bottom">
<h2>{{ item.albumName }}</h2>
<div class="item-bottom__info">
@@ -191,18 +191,7 @@
sizeType: ['compressed'],
sourceType: ['camera'],
success: res => {
let formData = new FormData()
formData.append('file', res.tempFiles[0])
this.$loading()
this.$http.post('/admin/file/add2?type=image', formData).then(res => {
if (res.code === 0) {
this.linkTo(`./Watermark?url=${res.data.url}`)
} else {
this.$u.toast(res.msg)
}
uni.hideLoading()
})
this.linkTo(`./Watermark?url=${encodeURIComponent(res.tempFilePaths[0])}`)
}
})
}