feat: add img tag with loading attribute for lazy loading

master
hawtimzhang 3 years ago
parent 107bf53a39
commit fab099c6fb

@ -16,7 +16,7 @@
><svg-icon icon-class="play" /> ><svg-icon icon-class="play" />
</button> </button>
</div> </div>
<img :src="imageUrl" :style="imageStyles" /> <img :src="imageUrl" :style="imageStyles" loading="lazy" />
<transition v-if="coverHover || alwaysShowShadow" name="fade"> <transition v-if="coverHover || alwaysShowShadow" name="fade">
<div <div
v-show="focus || alwaysShowShadow" v-show="focus || alwaysShowShadow"

@ -1,6 +1,6 @@
<template> <template>
<div class="daily-recommend-card" @click="goToDailyTracks"> <div class="daily-recommend-card" @click="goToDailyTracks">
<img :src="coverUrl" /> <img :src="coverUrl" loading="lazy" />
<div class="container"> <div class="container">
<div class="title-box"> <div class="title-box">
<div class="title"> <div class="title">

@ -1,9 +1,10 @@
<template> <template>
<div class="fm" :style="{ background }" data-theme="dark"> <div class="fm" :style="{ background }" data-theme="dark">
<img :src="nextTrackCover" style="display: none" /> <img :src="nextTrackCover" style="display: none" loading="lazy" />
<img <img
class="cover" class="cover"
:src="track.album && track.album.picUrl | resizeImage(512)" :src="track.album && track.album.picUrl | resizeImage(512)"
loading="lazy"
@click="goToAlbum" @click="goToAlbum"
/> />
<div class="right-part"> <div class="right-part">

@ -17,7 +17,7 @@
class="playlist" class="playlist"
@click="addTrackToPlaylist(playlist.id)" @click="addTrackToPlaylist(playlist.id)"
> >
<img :src="playlist.coverImgUrl | resizeImage(224)" /> <img :src="playlist.coverImgUrl | resizeImage(224)" loading="lazy" />
<div class="info"> <div class="info">
<div class="title">{{ playlist.name }}</div> <div class="title">{{ playlist.name }}</div>
<div class="track-count">{{ playlist.trackCount }} </div> <div class="track-count">{{ playlist.trackCount }} </div>

@ -7,7 +7,7 @@
@mouseleave="hoverVideoID = 0" @mouseleave="hoverVideoID = 0"
@click="goToMv(getID(mv))" @click="goToMv(getID(mv))"
> >
<img :src="getUrl(mv)" /> <img :src="getUrl(mv)" loading="lazy" />
<transition name="fade"> <transition name="fade">
<div <div
v-show="hoverVideoID === getID(mv)" v-show="hoverVideoID === getID(mv)"

@ -43,7 +43,12 @@
</div> </div>
</div> </div>
</div> </div>
<img class="avatar" :src="avatarUrl" @click="showUserProfileMenu" /> <img
class="avatar"
:src="avatarUrl"
@click="showUserProfileMenu"
loading="lazy"
/>
</div> </div>
</nav> </nav>

@ -27,6 +27,7 @@
<div class="container" @click.stop> <div class="container" @click.stop>
<img <img
:src="currentTrack.al && currentTrack.al.picUrl | resizeImage(224)" :src="currentTrack.al && currentTrack.al.picUrl | resizeImage(224)"
loading="lazy"
@click="goToAlbum" @click="goToAlbum"
/> />
<div class="track-info" :title="audioSource"> <div class="track-info" :title="audioSource">

@ -2,7 +2,10 @@
<div class="track-list"> <div class="track-list">
<ContextMenu ref="menu"> <ContextMenu ref="menu">
<div v-show="type !== 'cloudDisk'" class="item-info"> <div v-show="type !== 'cloudDisk'" class="item-info">
<img :src="rightClickedTrackComputed.al.picUrl | resizeImage(224)" /> <img
:src="rightClickedTrackComputed.al.picUrl | resizeImage(224)"
loading="lazy"
/>
<div class="info"> <div class="info">
<div class="title">{{ rightClickedTrackComputed.name }}</div> <div class="title">{{ rightClickedTrackComputed.name }}</div>
<div class="subtitle">{{ rightClickedTrackComputed.ar[0].name }}</div> <div class="subtitle">{{ rightClickedTrackComputed.ar[0].name }}</div>

@ -10,6 +10,7 @@
<img <img
v-if="!isAlbum" v-if="!isAlbum"
:src="imgUrl" :src="imgUrl"
loading="lazy"
:class="{ hover: focus }" :class="{ hover: focus }"
@click="goToAlbum" @click="goToAlbum"
/> />

@ -2,7 +2,7 @@
<div v-show="show" class="artist-page"> <div v-show="show" class="artist-page">
<div class="artist-info"> <div class="artist-info">
<div class="head"> <div class="head">
<img :src="artist.img1v1Url | resizeImage(1024)" /> <img :src="artist.img1v1Url | resizeImage(1024)" loading="lazy" />
</div> </div>
<div> <div>
<div class="name">{{ artist.name }}</div> <div class="name">{{ artist.name }}</div>
@ -75,7 +75,7 @@
@mouseleave="mvHover = false" @mouseleave="mvHover = false"
@click="goToMv(latestMV.id)" @click="goToMv(latestMV.id)"
> >
<img :src="latestMV.coverUrl" /> <img :src="latestMV.coverUrl" loading="lazy" />
<transition name="fade"> <transition name="fade">
<div <div
v-show="mvHover" v-show="mvHover"
@ -127,7 +127,7 @@
<div v-if="mvs.length !== 0" id="mvs" class="mvs"> <div v-if="mvs.length !== 0" id="mvs" class="mvs">
<div class="section-title" <div class="section-title"
>MVs >MVs
<router-link v-show="hasMoreMV" :to="`/artist/${this.artist.id}/mv`">{{ <router-link v-show="hasMoreMV" :to="`/artist/${artist.id}/mv`">{{
$t('home.seeMore') $t('home.seeMore')
}}</router-link> }}</router-link>
</div> </div>

@ -1,9 +1,11 @@
<template> <template>
<div v-show="show"> <div v-show="show">
<h1> <h1>
<img class="avatar" :src="artist.img1v1Url | resizeImage(1024)" />{{ <img
artist.name class="avatar"
}}'s Music Videos :src="artist.img1v1Url | resizeImage(1024)"
loading="lazy"
/>{{ artist.name }}'s Music Videos
</h1> </h1>
<MvRow :mvs="mvs" subtitle="publishTime" /> <MvRow :mvs="mvs" subtitle="publishTime" />
<div class="load-more"> <div class="load-more">

@ -1,9 +1,11 @@
<template> <template>
<div v-show="show" ref="library"> <div v-show="show" ref="library">
<h1> <h1>
<img class="avatar" :src="data.user.avatarUrl | resizeImage" />{{ <img
data.user.nickname class="avatar"
}}{{ $t('library.sLibrary') }} :src="data.user.avatarUrl | resizeImage"
loading="lazy"
/>{{ data.user.nickname }}{{ $t('library.sLibrary') }}
</h1> </h1>
<div class="section-one"> <div class="section-one">
<div class="liked-songs" @click="goToLikedSongsList"> <div class="liked-songs" @click="goToLikedSongsList">

@ -69,7 +69,7 @@
<div v-show="mode == 'qrCode'"> <div v-show="mode == 'qrCode'">
<div v-show="qrCodeSvg" class="qr-code-container"> <div v-show="qrCodeSvg" class="qr-code-container">
<img :src="qrCodeSvg" /> <img :src="qrCodeSvg" loading="lazy" />
</div> </div>
<div class="qr-code-info"> <div class="qr-code-info">
{{ qrCodeInformation }} {{ qrCodeInformation }}

@ -31,7 +31,11 @@
:class="{ active: user.nickname === activeUser.nickname }" :class="{ active: user.nickname === activeUser.nickname }"
@click="activeUser = user" @click="activeUser = user"
> >
<img class="head" :src="user.avatarUrl | resizeImage" /> <img
class="head"
:src="user.avatarUrl | resizeImage"
loading="lazy"
/>
<div class="nickname"> <div class="nickname">
{{ user.nickname }} {{ user.nickname }}
</div> </div>

@ -34,7 +34,7 @@
<div> <div>
<div class="cover"> <div class="cover">
<div class="cover-container"> <div class="cover-container">
<img :src="imageUrl" /> <img :src="imageUrl" loading="lazy" />
<div <div
class="shadow" class="shadow"
:style="{ backgroundImage: `url(${imageUrl})` }" :style="{ backgroundImage: `url(${imageUrl})` }"

@ -139,9 +139,12 @@
<div v-if="isLikeSongsPage" class="user-info"> <div v-if="isLikeSongsPage" class="user-info">
<h1> <h1>
<img class="avatar" :src="data.user.avatarUrl | resizeImage" />{{ <img
data.user.nickname class="avatar"
}}{{ $t('library.sLikedSongs') }} :src="data.user.avatarUrl | resizeImage"
loading="lazy"
/>
{{ data.user.nickname }}{{ $t('library.sLikedSongs') }}
</h1> </h1>
<div class="search-box-likepage" @click="searchInPlaylist()"> <div class="search-box-likepage" @click="searchInPlaylist()">
<div class="container" :class="{ active: inputFocus }"> <div class="container" :class="{ active: inputFocus }">

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save