fix(mp): 小程序页面优化 + E2E 测试报告更新
- 小程序各页面优化和修复 - 更新联调报告和 E2E 测试报告 - 更新 miniprogram wiki
This commit is contained in:
67
apps/miniprogram/src/components/SegmentTabs/index.scss
Normal file
67
apps/miniprogram/src/components/SegmentTabs/index.scss
Normal file
@@ -0,0 +1,67 @@
|
||||
@import '../../styles/variables.scss';
|
||||
|
||||
.seg-tabs {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
&--underline {
|
||||
border-bottom: 1px solid $bd-l;
|
||||
|
||||
.seg-tab {
|
||||
flex: 1;
|
||||
height: var(--tk-touch-min);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
|
||||
&--active {
|
||||
.seg-tab__text {
|
||||
color: $pri;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 30%;
|
||||
right: 30%;
|
||||
height: 4px;
|
||||
background: $pri;
|
||||
border-radius: $r-xs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.seg-tab__text {
|
||||
font-size: var(--tk-font-body-lg);
|
||||
color: $tx2;
|
||||
}
|
||||
}
|
||||
|
||||
&--pill {
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.seg-tab {
|
||||
padding: 8px 24px;
|
||||
border-radius: $r-pill;
|
||||
background: $surface-alt;
|
||||
|
||||
&--active {
|
||||
background: $pri;
|
||||
|
||||
.seg-tab__text {
|
||||
color: $card;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.seg-tab__text {
|
||||
font-size: var(--tk-font-body-lg);
|
||||
color: $tx2;
|
||||
}
|
||||
}
|
||||
}
|
||||
36
apps/miniprogram/src/components/SegmentTabs/index.tsx
Normal file
36
apps/miniprogram/src/components/SegmentTabs/index.tsx
Normal file
@@ -0,0 +1,36 @@
|
||||
import React from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import './index.scss';
|
||||
|
||||
interface Tab {
|
||||
key: string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
interface SegmentTabsProps {
|
||||
tabs: Tab[];
|
||||
activeKey: string;
|
||||
onChange: (key: string) => void;
|
||||
variant?: 'underline' | 'pill';
|
||||
}
|
||||
|
||||
export default React.memo(function SegmentTabs({
|
||||
tabs,
|
||||
activeKey,
|
||||
onChange,
|
||||
variant = 'underline',
|
||||
}: SegmentTabsProps) {
|
||||
return (
|
||||
<View className={`seg-tabs seg-tabs--${variant}`}>
|
||||
{tabs.map((tab) => (
|
||||
<View
|
||||
key={tab.key}
|
||||
className={`seg-tab ${activeKey === tab.key ? 'seg-tab--active' : ''}`}
|
||||
onClick={() => onChange(tab.key)}
|
||||
>
|
||||
<Text className='seg-tab__text'>{tab.label}</Text>
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user