Tabpanel标题active样式修改

本文介绍如何通过修改CSS样式来定制ExtJS中的Tab面板样式,包括设置背景图片和位置等。

做出来后的效果如下:

 

用到的图:

把图片添加到项目中,

在.jsp页面的ext-all.css定义后,添加

<STYLE type="text/css">
.x-tab-strip-top .x-tab-strip-active .x-tab-right {
 background-position: 0 0;
 background-image: url(<%=request.getContextPath()%>/images/tabs-sprite.jpg);
 
}
.x-tab-strip-top .x-tab-strip-active .x-tab-left {
 background-position: right -300px;
 background-image: url(<%=request.getContextPath()%>/images/tabs-sprite.jpg);
 
}
.x-tab-strip-top .x-tab-strip-active .x-tab-strip-inner {
 background-position: 0 -150px;
 background-image: url(<%=request.getContextPath()%>/images/tabs-sprite.jpg);
}
</STYLE>

即可.

<!-- src/views/PermissionApplyPage.vue --> <template> <div class="permission_apply_page"> <div class="permission-panel"> <!-- 标题 + 帮助图标 --> <div class="permission-panel-title"> {{ t('您没有当前页面的数据权限') }} <el-icon class="help-icon" @click="handleHelpClick" :size="20" style="margin-left: 8px; cursor: pointer" > <QuestionFilled /> </el-icon> </div> <!-- 内容区域 --> <div class="permission-panel-content"> <!-- Tab 按钮 --> <div class="tab-buttons" role="tablist"> <button v-for="tab in tabs" :key="tab.key" class="tab-btn" :class="{ active: currentTab === tab.key }" @click="switchTab(tab.key)" role="tab" :aria-selected="currentTab === tab.key" tabindex="0" > {{ tab.label }} </button> </div> <div v-if="tabs[tab.key]==="not-owned"> <NotOwnedPanel/> </div> </div> </div> </div> </template> <script setup lang="ts"> import { ref } from 'vue'; import { useI18n } from 'vue-i18n'; import { QuestionFilled } from '@element-plus/icons-vue'; import NotOwnedPanel from './components/NotOwnedPanel.vue'; import OwnedPanel from './components/OwnedPanel.vue'; import PendingPanel from './components/PendingPanel.vue'; const { t } = useI18n(); const tabs = [ { key: 'not-owned', label: '未拥有' }, { key: 'owned', label: '已拥有' }, { key: 'pending', label: '审批中' }, ] as const; const currentTab = ref<'not-owned' | 'owned' | 'pending'>('not-owned'); const switchTab = (key: typeof currentTab.value) => { currentTab.value = key; }; const handleHelpClick = () => { window.open( 'https://3ms.huawei.com/km/groups/3945222/blogs/details/18952136', '_blank', 'noopener,noreferrer' ); }; </script> <style scoped lang="less"> @primary-color: #5e7ce0; @text-dark: #252b3a; @tab-inactive-bg: var(--btn-hover-color); .permission_apply_page { width: 100%; height: 100%; overflow: auto; border-left: 3px solid gray; background: #fff; } .permission-panel { width: 1044px; margin: 0 auto; &-title { font-size: 27px; color: @text-dark; font-weight: 600; padding-top: 11vh; display: flex; align-items: center; gap: 8px; margin-bottom: 30px; } &-content { min-height: 400px; } } .tab-buttons { display: flex; margin-bottom: 20px; } .tab-btn { width: 99px; height: 31px; line-height: 31px; border: none; border-radius: 2px; cursor: pointer; font-size: 16px; font-weight: 500; background-color: @tab-inactive-bg; color: #333; border-right: 1px solid #ffffff; &:focus-visible { outline: 2px solid @primary-color; border-radius: 4px; } } .tab-btn.active { background-color: @primary-color; color: #fff; } .loading { text-align: center; padding: 40px; color: #666; font-style: italic; } </style> 帮我补全代码
最新发布
10-26
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值