From 89dc4e50525fbeb5ee4a4893b59c029542f4d857 Mon Sep 17 00:00:00 2001 From: lrl <742798240@qq.com> Date: Wed, 17 Nov 2021 18:10:01 +0800 Subject: [PATCH] perf: notice add scrollbar --- src/layout/components/notice/data.ts | 16 ++++++++++++++++ src/layout/components/notice/index.vue | 21 +++++++++++++++++---- src/layout/components/notice/noticeItem.vue | 1 - 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/layout/components/notice/data.ts b/src/layout/components/notice/data.ts index 4b0402b54..b918e6298 100644 --- a/src/layout/components/notice/data.ts +++ b/src/layout/components/notice/data.ts @@ -51,6 +51,22 @@ export const noticesData: TabItem[] = [ datetime: "一年前", description: "", type: "1" + }, + { + avatar: + "https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png", + title: "左侧图标用于区分不同的类型", + datetime: "一年前", + description: "", + type: "1" + }, + { + avatar: + "https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png", + title: "左侧图标用于区分不同的类型", + datetime: "一年前", + description: "", + type: "1" } ] }, diff --git a/src/layout/components/notice/index.vue b/src/layout/components/notice/index.vue index 90579c7da..e039ad8dd 100644 --- a/src/layout/components/notice/index.vue +++ b/src/layout/components/notice/index.vue @@ -5,12 +5,17 @@ import { noticesData } from "./data"; const activeName = ref(noticesData[0].name); const notices = ref(noticesData); + +let noticesNum = ref(0); +notices.value.forEach(notice => { + noticesNum.value += notice.list.length; +}); @@ -51,6 +60,10 @@ const notices = ref(noticesData); box-shadow: 0 2px 8px rgb(0 0 0 / 15%); border-radius: 4px; + :deep(.el-tabs__header) { + margin: 0; + } + :deep(.el-tabs__nav-scroll) { display: flex; justify-content: center; @@ -60,8 +73,8 @@ const notices = ref(noticesData); height: 1px; } - :deep(.el-tabs__content) { - padding: 0 24px; + :deep(.noticeList-container) { + padding: 15px 24px 0 24px; } } diff --git a/src/layout/components/notice/noticeItem.vue b/src/layout/components/notice/noticeItem.vue index 4110e87cb..900469050 100644 --- a/src/layout/components/notice/noticeItem.vue +++ b/src/layout/components/notice/noticeItem.vue @@ -15,7 +15,6 @@ const titleTooltip = ref(false); const descriptionTooltip = ref(false); function hoverTitle() { - titleTooltip.value = false; nextTick(() => { titleRef.value?.scrollWidth > titleRef.value?.clientWidth ? (titleTooltip.value = true)