fix: 修复歌单为空时的提示

This commit is contained in:
imsyy
2023-04-20 17:00:44 +08:00
parent 415cf3b3c9
commit ecdb3b75ba

View File

@@ -12,50 +12,57 @@
@mask-click="music.showPlayList = false" @mask-click="music.showPlayList = false"
> >
<n-drawer-content title="播放列表" :native-scrollbar="false" closable> <n-drawer-content title="播放列表" :native-scrollbar="false" closable>
<n-card <Transition mode="out-in">
hoverable <div v-if="music.getPlaylists[0]">
:class=" <n-card
index === music.persistData.playSongIndex ? 'songs play' : 'songs' hoverable
" :class="
:id="'playlist' + index" index === music.persistData.playSongIndex ? 'songs play' : 'songs'
:content-style="{ "
padding: '8px', :id="'playlist' + index"
display: 'flex', :content-style="{
flexDirection: 'row', padding: '8px',
alignItems: 'center', display: 'flex',
}" flexDirection: 'row',
v-for="(item, index) in music.getPlaylists" alignItems: 'center',
:key="item" }"
@click="changeIndex(index)" v-for="(item, index) in music.getPlaylists"
> :key="item"
<div class="left"> @click="changeIndex(index)"
<div v-if="index !== music.persistData.playSongIndex" class="num"> >
{{ index + 1 }} <div class="left">
</div> <div v-if="index !== music.persistData.playSongIndex" class="num">
<div v-else class="bar"> {{ index + 1 }}
<div </div>
v-for="item in 3" <div v-else class="bar">
:key="item" <div
class="line" v-for="item in 3"
:style="{ :key="item"
animationDelay: `0.${item * item}s`, class="line"
animationPlayState: music.getPlayState ? 'running' : 'paused', :style="{
height: `${Math.floor(Math.random() * 7) + 10}px`, animationDelay: `0.${item * item}s`,
}" animationPlayState: music.getPlayState
/> ? 'running'
</div> : 'paused',
height: `${Math.floor(Math.random() * 7) + 10}px`,
}"
/>
</div>
</div>
<div class="right">
<div class="name text-hidden">{{ item.name }}</div>
<AllArtists class="text-hidden" :artistsData="item.artist" />
<n-icon
class="remove"
size="18"
:component="DeleteFour"
@click.stop="music.removeSong(index)"
/>
</div>
</n-card>
</div> </div>
<div class="right"> <n-text v-else>暂无歌曲请前往列表添加</n-text>
<div class="name text-hidden">{{ item.name }}</div> </Transition>
<AllArtists class="text-hidden" :artistsData="item.artist" />
<n-icon
class="remove"
size="18"
:component="DeleteFour"
@click.stop="music.removeSong(index)"
/>
</div>
</n-card>
</n-drawer-content> </n-drawer-content>
</n-drawer> </n-drawer>
</template> </template>
@@ -113,6 +120,15 @@ onBeforeUnmount(() => {
<style lang="scss" scoped> <style lang="scss" scoped>
.playlist-drawer { .playlist-drawer {
.v-enter-active,
.v-leave-active {
transition: opacity 0.3s ease;
}
.v-enter-from,
.v-leave-to {
opacity: 0;
}
.songs { .songs {
border-radius: 8px; border-radius: 8px;
cursor: pointer; cursor: pointer;