import React, { useState, useEffect } from 'react'; import ChartColorPicker from '../RegularColorPicker/ColorPicker'; import { InputNumber, Popover, Tooltip } from 'antd'; export default function twoInput(props: IProps) { const { color, max, min, index, theme = 'white', fillType = '', isPure = false, change, status, length } = props; const dom = document; // document const [close, setClose] = useState(true); const [minValue, setMinValue] = useState(min); const [maxValue, setMaxValue] = useState(max); const [visible, setVisible] = useState(false); const [oldMax, setOldMax] = useState(0); const [oldMin, setOldMin] = useState(0); useEffect(() => { setMinValue(min); }, [min]); useEffect(() => { setMaxValue(max); }, [max]); useEffect(() => { setOldMax(max); }, []); useEffect(() => { setOldMin(min); }, []); useEffect(() => { dom.addEventListener('mousedown', isPopover); return () => { dom?.removeEventListener('mousedown', isPopover); }; }, []); const isPopover = (e) => { if ( !( elementContains( document.querySelector('.color-pick-select'), e.target ) || elementContains(document.querySelector('.colorPopover'), e.target) || elementContains( document.querySelector('.zl-large-screen-setting'), e.target ) ) ) { setClose(true); } }; // 判断父元素是否包含某个元素 const elementContains = (parent, child) => parent !== child && parent?.contains(child); //确认事件 const handleChange = (params, type) => { change(params, type, index - 1); setClose(true); }; const content1 = (value) => { return (