import React, { useEffect, useRef } from 'react'; import { Tabs } from 'zarm'; import styles from './index.less'; import { ITabConfig } from './schema'; import logo from '@/assets/tab.png'; interface TabType extends ITabConfig { isTpl?: boolean; } const { Panel } = Tabs; const XTab = (props: TabType) => { 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 ? (
) : (
{ console.log(i); }} > {tabs.map((item, i) => { return (
{sourceData .filter(item => item.type === i) .map((item, i) => { return (
{item.title}
{item.title}
{item.price}
); })}
); })}
); }; export default XTab;