This commit is contained in:
2023-10-11 23:23:07 +08:00
parent e93cccd054
commit 02c2309255
16 changed files with 522 additions and 205 deletions

View File

@@ -6,18 +6,24 @@ import { SONG_API_URL, USER_API_URL } from '@/data/constants'
import { onMounted, ref } from 'vue'
import { useRouteParams } from '@vueuse/router'
import { useAccount } from '@/api/account'
import { NAlert } from 'naive-ui'
const accountInfo = useAccount()
const songs = ref<SongsInfo[]>()
const uId = useRouteParams('id', '-1', { transform: Number })
const errMessage = ref('')
async function getSongs() {
await QueryGetAPI<SongsInfo[]>(SONG_API_URL + 'get', {
uId: uId.value,
id: uId.value,
}).then((data) => {
if (data.code == 200) {
songs.value = data.data
}
else {
errMessage.value = data.message
}
})
}
@@ -27,6 +33,8 @@ onMounted(async () => {
</script>
<template>
歌单
<SongList :songs="songs ?? []" />
<SongList v-if="songs" :songs="songs ?? []" />
<NAlert v-else-if="errMessage" type="error">
{{ errMessage }}
</NAlert>
</template>