import React, { useContext, useEffect, useState } from 'react';
import IOTBottomSlide from '../../../common/IOTBottomSlide/index';
import IOTAllGrid from '../../IOTAllGrid';
import './ModelItem.less';
interface IProps {
title?: string;
// top1List: any;
topList: any;
middleList: any[][];
footList: any;
modelFootList: any;
modelTopList: any;
showMore: boolean;
control: (e: any) => void;
iconShow?: boolean;
styleType: string;
}
const getItem = (len: number) => {
const itemLen = len;
const itemWidth = Math.floor((1 / itemLen) * 1000) / 10 + '%';
const style = {
gridTemplateColumns: `repeat(${itemLen}, ${itemWidth})`,
};
return style;
};
const ModelItem = ({
title,
// top1List,
topList,
middleList,
footList,
modelFootList,
modelTopList,
showMore,
control,
styleType,
iconShow = false,
}: IProps) => {
const [btm, setBtm] = useState(false);
const [btmBarType, setBtmBarType] = useState('show');
return (
{
styleType !== '1' &&
}
{topList.length <= 4 && (
{topList.map((item: any, index: number) => {
return (
{
if (item['disabled']) return;
control(item);
}}
key={index}
>
3 ? 'text-ellipse' : ''}`}>{item.text}
{
item['disabled'] && (
)
}
);
})}
)}
{footList.length > 0 && (
<>
{/*
*/}
{footList.map((item: any, index: number) => {
return (
{
if (item.value === null || item['disabled']) return;
control(item);
}}
key={index}
>
3 ? 'text-ellipse' : ''}`}>{item.text}
{
item['disabled'] && (
)
}
);
})}
>
)}
{
styleType !== '1' && showMore &&
}
{showMore && (
{
const bodyDom = document.querySelectorAll('body') as NodeListOf
;
bodyDom[0].style.overflow = 'hidden';
setBtm(true);
}}
>
更多设置
)}
{
// console.log(val);
setTimeout(() => {
const bodyDom = document.querySelectorAll('body') as NodeListOf;
bodyDom[0].style.overflow = 'auto';
setBtm(false);
}, 500);
}}
leftText={`更多${title}`} rightText='取消' type={btmBarType} title={title}>
{
control(val);
setTimeout(() => {
const bodyDom = document.querySelectorAll('body') as NodeListOf;
bodyDom[0].style.overflow = 'auto';
setBtm(false);
}, 500);
}}
/>
);
};
export default ModelItem;