import React, { memo, useEffect, useRef } from 'react'; import { Tabs } from 'zarm'; import styles from './index.less'; import { ITabConfig } from './schema'; import logo from '@/assets/11-切换页.png'; const { Panel } = Tabs; const XTab = (props: ITabConfig & { isTpl: boolean }) => { const { tabs = ['分类一', '分类二'], activeColor, color, fontSize, sourceData, isTpl } = props; const tabWrapRef = useRef(null); useEffect(() => { if (tabWrapRef.current) { let res = tabWrapRef.current.querySelector('.za-tabs__line') as HTMLElement; if (res) { res.style.backgroundColor = activeColor; } } }, [activeColor]); return ( <> {isTpl ? (
) : (
{tabs.map((item, i) => { return (
{sourceData .filter(item => item.type === i) .map((item, i) => { return ( ); })}
); })}
)} ); }; export default memo(XTab);