feat: less规范化

This commit is contained in:
ZhuRui
2026-07-28 10:54:36 +08:00
parent cffe8de6b0
commit 743549600a
45 changed files with 1953 additions and 2011 deletions
@@ -61,6 +61,7 @@ export default defineComponent({
destroyOnClose
footer={null}
centered
wrapClassName={styles.changePasswordModalMain}
class={styles.modal}
>
<Form ref={formRef} layout="vertical" model={formData} class={styles.form} requiredMark>
@@ -1,37 +1,36 @@
.form {
:global {
.ant-form-item {
margin-bottom: 16px;
}
.ant-form-item-explain-error {
font-size: 12px;
.changePasswordModalMain {
.modal {
:global {
.ant-modal-body {
padding: 16px 24px 0;
}
}
}
}
/* 底部提示文案 */
.tip {
margin-top: -4px;
margin-bottom: 24px;
color: rgba(0, 0, 0, 0.45);
font-size: 12px;
line-height: 1.5;
}
/* 底部按钮 */
.footer {
display: flex;
justify-content: flex-end;
gap: 8px;
padding-top: 16px;
border-top: 1px solid #f0f0f0;
}
/* 微调 Modal 内部样式 */
.modal {
:global {
.ant-modal-body {
padding: 16px 24px 0;
.form {
:global {
.ant-form-item {
margin-bottom: 16px;
}
.ant-form-item-explain-error {
font-size: 12px;
}
}
}
.tip {
margin-top: -4px;
margin-bottom: 24px;
color: rgba(0, 0, 0, 0.45);
font-size: 12px;
line-height: 1.5;
}
.footer {
display: flex;
justify-content: flex-end;
gap: 8px;
padding-top: 16px;
border-top: 1px solid #f0f0f0;
}
}
+10 -10
View File
@@ -1,16 +1,16 @@
.container {
.helloWorldMain {
text-align: center;
padding: 16px;
}
.title {
color: #1677ff;
}
.title {
color: #1677ff;
}
.desc {
code {
background: #f5f5f5;
padding: 2px 6px;
border-radius: 4px;
.desc {
code {
background: #f5f5f5;
padding: 2px 6px;
border-radius: 4px;
}
}
}
+1 -1
View File
@@ -14,7 +14,7 @@ export default defineComponent({
},
setup(props) {
return () => (
<div class={styles.container}>
<div class={styles.helloWorldMain}>
<h3 class={styles.title}>{props.msg}</h3>
<p class={styles.desc}>
, TSX
+1 -1
View File
@@ -4,4 +4,4 @@
*/
export { default as HelloWorld } from './HelloWorld';
export { default as ChangePasswordModal } from './ChangePasswordModal';
export { default as PageTabs } from './page/PageTabs';
export { default as PageTabs } from './pageTabs/PageTabs';
-185
View File
@@ -1,185 +0,0 @@
/**
* PageTabs — Chrome 风格标签栏样式
*
* 参考 VBEN tabs-chrome 的视觉设计:
* - 标签间通过负 margin 重叠
* - 激活态使用 SVG 绘制左下/右下曲线填充,形成 Chrome tab 效果
* - hover 态浅灰背景
* - 分隔线在相邻非激活标签之间
*/
// 主色调(antd 默认蓝)
@primary: #1677ff;
.tabsWrap {
display: flex;
align-items: center;
width: 100%;
height: 100%;
overflow-x: auto;
overflow-y: hidden;
// 隐藏横向滚动条
&::-webkit-scrollbar {
height: 0;
}
}
.tabItem {
position: relative;
display: flex;
align-items: center;
height: 100%;
user-select: none;
transition: all 0.15s ease;
padding: 0 8px 0 14px;
&:global(:not(.dragging)) {
cursor: pointer;
}
// ── hover 态(非激活) ──
&:not(.tabItemActive) {
&:hover {
// 自身分隔线消失
> .divider {
opacity: 0;
}
// 右侧邻居的分隔线也消失
& + .tabItem {
> .divider {
opacity: 0;
}
}
}
}
// ── 激活态 ──
&.tabItemActive {
z-index: 2;
// 右侧邻居的分隔线消失
& + .tabItem {
> .divider {
opacity: 0 !important;
}
}
// 文字激活色
.tabTitle {
color: @primary;
font-weight: 500;
}
// 背景蓝色
.tabBg {
&.tabBgActive {
.tabBgInner {
background-color: fade(@primary, 8%);
}
.tabBgCurveBefore,
.tabBgCurveAfter {
fill: fade(@primary, 8%);
}
}
}
}
}
// ── 分隔线 ──
.divider {
position: absolute;
left: 7px;
top: 50%;
z-index: 0;
width: 1px;
height: 16px;
background-color: #e8e8e8;
transform: translateY(-50%);
transition: opacity 0.15s;
}
// ── Chrome 风格背景层(激活态可见,hover 态可见但偏浅) ──
.tabBg {
position: absolute;
top: 0;
left: 0;
z-index: -1;
width: 100%;
height: 100%;
padding: 0 calc(7px - 1px);
transition: opacity 0.15s;
}
// 背景主体:顶部圆角
.tabBgInner {
height: 100%;
border-radius: 7px 7px 0 0;
transition:
background-color 0.15s,
margin 0.15s,
border-radius 0.15s;
}
// 左下 SVG 曲线
.tabBgCurveBefore {
position: absolute;
left: -1px;
bottom: 0;
fill: transparent;
transition: fill 0.15s;
}
// 右下 SVG 曲线
.tabBgCurveAfter {
position: absolute;
right: -1px;
bottom: 0;
fill: transparent;
transition: fill 0.15s;
}
// ── 关闭按钮(flex 子元素,文字同行自然居中) ──
.tabClose {
flex-shrink: 0;
width: 16px;
height: 16px;
line-height: 16px;
font-size: 10px;
text-align: center;
margin-right: 12px;
color: rgba(0, 0, 0, 0.45);
border-radius: 50%;
cursor: pointer;
transition: all 0.15s;
&:hover {
color: rgba(0, 0, 0, 0.85);
background-color: rgba(0, 0, 0, 0.06);
}
}
.tabTitleCon {
height: 28px;
display: flex;
justify-content: center;
align-items: center;
border-radius: 4px;
}
// hover 只在非激活标签时生效
.tabItem:not(.tabItemActive) {
.tabTitleCon:hover {
background-color: rgba(0, 0, 0, 0.06);
}
}
// ── 标签文字(flex 子元素,可收缩) ──
.tabTitle {
position: relative;
z-index: 2;
flex: 1;
min-width: 0;
padding: 2px 8px;
font-size: 13px;
color: rgba(0, 0, 0, 0.65);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
@@ -1,47 +0,0 @@
// 页面布局根容器:筛选区 + 表格区作为直接子元素
.containerMain {
display: flex;
flex-direction: column;
height: 100%;
// 页面筛选区域:横向 flex,可换行
.filter {
display: flex;
flex-wrap: wrap;
align-items: center;
column-gap: 16px;
row-gap: 12px;
flex-shrink: 0;
padding: 16px;
background-color: #fff;
border-radius: 10px;
}
// 筛选区域操作按钮组
.filterActions {
display: flex;
align-items: center;
gap: 10px;
margin-left: 0;
}
// 表格显示区域:纵向 flex,占据剩余高度
.table {
display: flex;
flex-direction: column;
flex: 1;
background-color: #fff;
min-height: 0;
min-width: 0;
margin-top: 16px;
overflow: hidden;
border-radius: 10px;
.pagination {
flex-shrink: 0;
display: flex;
justify-content: flex-end;
padding: 14px;
}
}
}
@@ -0,0 +1,164 @@
@primary: #1677ff;
.pageTabsMain {
display: flex;
align-items: center;
width: 100%;
height: 100%;
overflow-x: auto;
overflow-y: hidden;
&::-webkit-scrollbar {
height: 0;
}
.tabItem {
position: relative;
display: flex;
align-items: center;
height: 100%;
user-select: none;
transition: all 0.15s ease;
padding: 0 8px 0 14px;
&:global(:not(.dragging)) {
cursor: pointer;
}
&:not(.tabItemActive) {
&:hover {
> .divider {
opacity: 0;
}
& + .tabItem {
> .divider {
opacity: 0;
}
}
}
}
&.tabItemActive {
z-index: 2;
& + .tabItem {
> .divider {
opacity: 0 !important;
}
}
.tabTitle {
color: @primary;
font-weight: 500;
}
.tabBg {
&.tabBgActive {
.tabBgInner {
background-color: fade(@primary, 8%);
}
.tabBgCurveBefore,
.tabBgCurveAfter {
fill: fade(@primary, 8%);
}
}
}
}
&:not(.tabItemActive) {
.tabTitleCon:hover {
background-color: rgba(0, 0, 0, 0.06);
}
}
}
.divider {
position: absolute;
left: 7px;
top: 50%;
z-index: 0;
width: 1px;
height: 16px;
background-color: #e8e8e8;
transform: translateY(-50%);
transition: opacity 0.15s;
}
.tabBg {
position: absolute;
top: 0;
left: 0;
z-index: -1;
width: 100%;
height: 100%;
padding: 0 calc(7px - 1px);
transition: opacity 0.15s;
}
.tabBgInner {
height: 100%;
border-radius: 7px 7px 0 0;
transition:
background-color 0.15s,
margin 0.15s,
border-radius 0.15s;
}
.tabBgCurveBefore {
position: absolute;
left: -1px;
bottom: 0;
fill: transparent;
transition: fill 0.15s;
}
.tabBgCurveAfter {
position: absolute;
right: -1px;
bottom: 0;
fill: transparent;
transition: fill 0.15s;
}
.tabClose {
flex-shrink: 0;
width: 16px;
height: 16px;
line-height: 16px;
font-size: 10px;
text-align: center;
margin-right: 12px;
color: rgba(0, 0, 0, 0.45);
border-radius: 50%;
cursor: pointer;
transition: all 0.15s;
&:hover {
color: rgba(0, 0, 0, 0.85);
background-color: rgba(0, 0, 0, 0.06);
}
}
.tabTitleCon {
height: 28px;
display: flex;
justify-content: center;
align-items: center;
border-radius: 4px;
}
.tabTitle {
position: relative;
z-index: 2;
flex: 1;
min-width: 0;
padding: 2px 8px;
font-size: 13px;
color: rgba(0, 0, 0, 0.65);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
@@ -43,7 +43,7 @@ const PageTabs = defineComponent({
};
return () => (
<div class={styles.tabsWrap}>
<div class={styles.pageTabsMain}>
{props.tabs.map((tab, i) => {
const isActive = tab.path === props.activeKey;
return (