-
清空
-
- 全部已读
-
-
- 查看更多
-
+
@@ -53,9 +49,9 @@ import { useThemeStore } from '@/store';
import { useBoolean } from '@/hooks';
import MessageList from './MessageList.vue';
-const currentTab = ref(0);
const theme = useThemeStore();
const { bool: loading, setBool: setLoading } = useBoolean();
+const currentTab = ref(0);
const tabData = ref
([
{
key: 1,
@@ -185,19 +181,25 @@ const count = computed(() => {
}, 0);
});
-function handleClear(index: number) {
- tabData.value[index].list = [];
+const showAction = computed(() => tabData.value[currentTab.value].list.length > 0);
+
+function handleRead(index: number) {
+ tabData.value[currentTab.value].list[index].isRead = true;
}
-function handleAllRead(index: number) {
- tabData.value[index].list.map(item => Object.assign(item, { isRead: true }));
+function handleAllRead() {
+ tabData.value[currentTab.value].list.map(item => Object.assign(item, { isRead: true }));
}
-function handleLoadMore(index: number) {
- const { list } = tabData.value[index];
+function handleClear() {
+ tabData.value[currentTab.value].list = [];
+}
+
+function handleLoadMore() {
+ const { list } = tabData.value[currentTab.value];
setLoading(true);
setTimeout(() => {
- list.push(...tabData.value[index].list);
+ list.push(...tabData.value[currentTab.value].list);
setLoading(false);
}, 1000);
}