add album header info

This commit is contained in:
geoffrey45
2021-12-27 23:12:00 +03:00
parent 3f52bb74d8
commit ff6a4e34b5
9 changed files with 141 additions and 63 deletions
+24 -4
View File
@@ -1,11 +1,11 @@
<template>
<div class="al-view rounded">
<div class="header">
<Header />
<Header :album_info="album_info"/>
</div>
<div class="separator" id="av-sep"></div>
<div>
<SongList />
<SongList :album_songs="album_songs"/>
</div>
<div class="separator" id="av-sep"></div>
<FeaturedArtists />
@@ -17,7 +17,8 @@
</template>
<script>
// import { useRoute } from 'vue-router'
import { useRoute } from "vue-router";
import { onMounted, ref } from "@vue/runtime-core";
import Header from "../components/AlbumView/Header.vue";
import AlbumBio from "../components/AlbumView/AlbumBio.vue";
@@ -26,6 +27,8 @@ import FromTheSameArtist from "../components/AlbumView/FromTheSameArtist.vue";
import SongList from "../components/PlaylistView/SongList.vue";
import FeaturedArtists from "../components/PlaylistView/FeaturedArtists.vue";
import getAlbum from "../composables/getAlbum.js";
export default {
components: {
Header,
@@ -34,7 +37,24 @@ export default {
SongList,
FeaturedArtists,
},
setup() {},
setup() {
const route = useRoute();
const album_name = route.params.album;
const album_songs = ref([]);
const album_info = ref({});
onMounted(() => {
getAlbum(album_name).then((data) => {
album_songs.value = data.songs;
album_info.value = data.info;
});
});
return {
album_songs,
album_info,
};
},
};
</script>
+3 -10
View File
@@ -33,8 +33,6 @@ export default {
const songs = ref([]);
const folders = ref([]);
const last_page = ref([]);
const last_song_id = ref(null);
const scrollable = ref(null);
const loading = ref(false);
@@ -45,14 +43,9 @@ export default {
getData(path, last_id).then((data) => {
scrollable.value.scrollTop = 0;
songs.value = data.songs.value;
last_page.value = songs.value;
if (songs.value.length) {
last_song_id.value = songs.value.slice(-1)[0]._id.$oid;
}
folders.value = data.folders.value;
songs.value = data.songs;
folders.value = data.folders;
loading.value = false;
});
};