Skip to content

Commit

Permalink
refactor(projects): 代码优化
Browse files Browse the repository at this point in the history
  • Loading branch information
yanbowe committed Jun 17, 2022
1 parent 894b0f1 commit 41147b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
10 changes: 3 additions & 7 deletions src/layouts/common/GlobalHeader/components/MessageList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<Icon v-else-if="item.icon" class="text-34px text-primary" :icon="item.icon" />
</template>
<template #header>
<n-ellipsis :line-clamp="titleRows" :tooltip="{ placement: 'top' }">
<n-ellipsis :line-clamp="1">
{{ item.title }}
<template #tooltip>
{{ item.title }}
Expand All @@ -25,7 +25,7 @@
<n-tag v-bind="item.tagProps" size="small">{{ item.tagTitle }}</n-tag>
</template>
<template #description>
<n-ellipsis v-if="item.description" :line-clamp="descRows">
<n-ellipsis v-if="item.description" :line-clamp="2">
{{ item.description }}
</n-ellipsis>
<p>{{ item.date }}</p>
Expand All @@ -40,18 +40,14 @@ import { Icon } from '@iconify/vue';
interface Props {
list?: Message.List[];
titleRows?: number;
descRows?: number;
}
interface Emits {
(e: 'read', val: number): void;
}
withDefaults(defineProps<Props>(), {
list: () => [],
titleRows: 1,
descRows: 2
list: () => []
});
const emit = defineEmits<Emits>();
Expand Down
9 changes: 4 additions & 5 deletions src/layouts/common/GlobalHeader/components/SystemMessage.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<template>
<n-popover trigger="click" class="!p-0" placement="bottom">
<n-popover class="!p-0" trigger="click" placement="bottom">
<template #trigger>
<hover-container tooltip-content="消息通知" class="w-40px h-full relative" :inverted="theme.header.inverted">
<hover-container class="w-40px h-full relative" tooltip-content="消息通知" :inverted="theme.header.inverted">
<icon-clarity:notification-line class="text-18px" />
<n-badge
:value="count"
:show="count > 0"
:max="99"
:class="[count < 10 ? '-right-2px' : '-right-10px']"
class="absolute top-10px"
/>
</hover-container>
</template>
<n-tabs v-model:value="currentTab" type="line" class="w-360px" justify-content="space-evenly">
<n-tabs v-model:value="currentTab" class="w-360px" type="line" justify-content="space-evenly">
<n-tab-pane v-for="(item, index) in tabData" :key="item.key" :name="index">
<template #tab>
<div class="flex-x-center items-center w-120px">
Expand All @@ -21,7 +20,7 @@
v-bind="item.badgeProps"
:value="item.list.filter(message => !message.isRead).length"
:max="99"
:show="item.list.length !== 0"
show-zero
/>
</div>
</template>
Expand Down

0 comments on commit 41147b3

Please sign in to comment.