Files
hms/apps/miniprogram/src/components/SegmentTabs/index.tsx
iven c06e986090 fix(mp): 小程序页面优化 + E2E 测试报告更新
- 小程序各页面优化和修复
- 更新联调报告和 E2E 测试报告
- 更新 miniprogram wiki
2026-05-15 23:03:21 +08:00

37 lines
793 B
TypeScript

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>
);
});