修改
This commit is contained in:
@@ -55,7 +55,7 @@
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent, PropType, ref, watch, unref } from 'vue';
|
||||
import { ListItem } from './data';
|
||||
import { BizListItem } from '@jeesite/biz/api/biz/listItem';
|
||||
import { useDesign } from '@jeesite/core/hooks/web/useDesign';
|
||||
import { List, Avatar, Tag, Typography } from 'ant-design-vue';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
@@ -73,7 +73,7 @@
|
||||
},
|
||||
props: {
|
||||
list: {
|
||||
type: Array as PropType<ListItem[]>,
|
||||
type: Array as PropType<BizListItem[]>,
|
||||
default: () => [],
|
||||
},
|
||||
pageSize: {
|
||||
@@ -100,7 +100,7 @@
|
||||
setup(props, { emit }) {
|
||||
const { prefixCls } = useDesign('header-notify-list');
|
||||
const current = ref(props.currentPage || 1);
|
||||
const getData = computed<ListItem[]>(() => {
|
||||
const getData = computed<BizListItem[]>(() => {
|
||||
const { pageSize, list } = props;
|
||||
if (pageSize === false) return [];
|
||||
let size = isNumber(pageSize) ? pageSize : 5;
|
||||
@@ -131,7 +131,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
function handleTitleClick(item: ListItem) {
|
||||
function handleTitleClick(item: BizListItem) {
|
||||
props.onTitleClick && props.onTitleClick(item);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
<span v-if="item.list.length !== 0">({{ item.list.length }})</span>
|
||||
</template>
|
||||
<!-- 绑定title-click事件的通知列表中标题是“可点击”的-->
|
||||
<NoticeList :list="item.list" v-if="item.key === '1'" @title-click="onNoticeClick" />
|
||||
<NoticeList :list="item.list" v-else />
|
||||
<NoticeList :list="item.list" @title-click="onNoticeClick" />
|
||||
</TabPane>
|
||||
</template>
|
||||
</Tabs>
|
||||
@@ -23,33 +22,36 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent, ref } from 'vue';
|
||||
import { computed, defineComponent, onMounted, ref } from 'vue';
|
||||
import { Popover, Tabs, Badge } from 'ant-design-vue';
|
||||
import { BellOutlined } from '@ant-design/icons-vue';
|
||||
import { tabListData, ListItem } from './data';
|
||||
import NoticeList from './NoticeList.vue';
|
||||
import { useDesign } from '@jeesite/core/hooks/web/useDesign';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { tabListDataAll, TabItem, BizListItem } from '@jeesite/biz/api/biz/listItem';
|
||||
|
||||
export default defineComponent({
|
||||
components: { Popover, BellOutlined, Tabs, TabPane: Tabs.TabPane, Badge, NoticeList },
|
||||
setup() {
|
||||
const { prefixCls } = useDesign('header-notify');
|
||||
const { createMessage } = useMessage();
|
||||
const listData = ref(tabListData);
|
||||
|
||||
const count = computed(() => {
|
||||
const listData = ref<TabItem[]>([]);
|
||||
|
||||
onMounted(async () => {
|
||||
const response = await tabListDataAll();
|
||||
listData.value = response;
|
||||
});
|
||||
|
||||
const count = computed(() => {
|
||||
let count = 0;
|
||||
for (let i = 0; i < tabListData.length; i++) {
|
||||
count += tabListData[i].list.length;
|
||||
for (let i = 0; i < listData.value.length; i++) {
|
||||
count += listData.value[i].list.length;
|
||||
}
|
||||
return count;
|
||||
});
|
||||
|
||||
function onNoticeClick(record: ListItem) {
|
||||
function onNoticeClick(record: BizListItem) {
|
||||
createMessage.success('你点击了通知,ID=' + record.id);
|
||||
// 可以直接将其标记为已读(为标题添加删除线),此处演示的代码会切换删除线状态
|
||||
record.titleDelete = !record.titleDelete;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<template>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
Reference in New Issue
Block a user