feat: 添加 tab监听以刷新下载列表

This commit is contained in:
alger
2025-05-22 20:59:06 +08:00
parent ca51020602
commit df5ecb6eb5

View File

@@ -17,7 +17,7 @@
> >
<n-drawer-content :title="t('download.title')" closable :native-scrollbar="false"> <n-drawer-content :title="t('download.title')" closable :native-scrollbar="false">
<div class="drawer-container"> <div class="drawer-container">
<n-tabs type="line" animated class="h-full"> <n-tabs type="line" animated class="h-full" v-model:value="tabName">
<!-- 下载列表 --> <!-- 下载列表 -->
<n-tab-pane name="downloading" :tab="t('download.tabs.downloading')" class="h-full"> <n-tab-pane name="downloading" :tab="t('download.tabs.downloading')" class="h-full">
<div class="download-list"> <div class="download-list">
@@ -249,7 +249,7 @@ interface DownloadedItem {
picUrl: string; picUrl: string;
ar: { name: string }[]; ar: { name: string }[];
} }
const tabName = ref('downloading');
const message = useMessage(); const message = useMessage();
// const playerStore = usePlayerStore(); // const playerStore = usePlayerStore();
const settingsStore = useSettingsStore(); const settingsStore = useSettingsStore();
@@ -540,6 +540,16 @@ onMounted(() => {
const handleDrawerClose = () => { const handleDrawerClose = () => {
settingsStore.showDownloadDrawer = false; settingsStore.showDownloadDrawer = false;
}; };
watch(
() => tabName.value,
(newVal) => {
if (newVal) {
refreshDownloadedList();
}
}
);
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>