This commit is contained in:
yangzhe 2025-07-09 15:37:24 +08:00
commit 3ee52b2faf
1 changed files with 40 additions and 42 deletions

View File

@ -2,23 +2,23 @@
<div class="notes-page"> <div class="notes-page">
<div class="header"> <div class="header">
<div class="title">留言板</div> <div class="title">留言板</div>
<!-- 顶部切换标签 --> <view class="custom-tabs-box">
<div class="tab-header"> <u-tabs
<div :list="tabList"
class="tab-item" :current="tabCurrent"
:class="{ active: activeTab === 'unread' }" @change="onTabChange"
@click="switchTab('unread')" :is-scroll="false"
> :height="80"
未回复 :font-size="28"
</div> active-color="#4A6CF7"
<div inactive-color="#333333"
class="tab-item" :bar-width="120"
:class="{ active: activeTab === 'replied' }" :bar-height="4"
@click="switchTab('replied')" bg-color="#ffffff"
> :item-width="200"
已回复 item-style="padding-left: 0; padding-right: 0;"
</div> ></u-tabs>
</div> </view>
</div> </div>
<!-- 内容区域包装器 --> <!-- 内容区域包装器 -->
@ -110,6 +110,11 @@ export default {
}, },
data() { data() {
return { return {
tabList: [
{ name: '未回复' },
{ name: '已回复' }
],
tabCurrent: 0,
activeTab: 'unread', activeTab: 'unread',
showDevModal: false, showDevModal: false,
defaultAvatar: '/static/avatar/default-avatar.png', defaultAvatar: '/static/avatar/default-avatar.png',
@ -166,8 +171,17 @@ export default {
} }
}, },
methods: { methods: {
onTabChange(index) {
this.tabCurrent = index;
// activeTab
this.activeTab = index === 0 ? 'unread' : 'replied';
//
this.closeAllSwipe();
},
switchTab(tab) { switchTab(tab) {
this.activeTab = tab; this.activeTab = tab;
// tabCurrentactiveTab
this.tabCurrent = tab === 'unread' ? 0 : 1;
// //
this.closeAllSwipe(); this.closeAllSwipe();
}, },
@ -255,36 +269,20 @@ export default {
padding: 10px 0; padding: 10px 0;
} }
/* 顶部切换标签样式 */ .custom-tabs-box {
.tab-header { padding-left: 20px; /* 添加左侧padding使tabs位于左侧 */
display: flex;
height: 40px;
border-bottom: 1px solid #f0f0f0;
}
.tab-item {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
font-size: 14px;
color: #333;
position: relative; position: relative;
box-sizing: border-box;
} }
.tab-item.active { .custom-tabs-box >>> .u-tabs__wrapper__nav__item {
color: #4A6CF7; padding: 0 20px 0 0 !important; /* 调整标签项的padding */
font-weight: 500;
} }
.tab-item.active::after { .custom-tabs-box >>> .u-tabs__wrapper__nav__line {
content: ''; bottom: 0 !important; /* 确保下划线位于底部 */
position: absolute; height: 4px !important; /* 设置下划线高度 */
bottom: 0; border-radius: 2px !important; /* 圆角 */
left: 0;
width: 100%;
height: 2px;
background-color: #4A6CF7;
} }
.content-wrapper { .content-wrapper {