XJQ124 / Some-notes

本仓库记录一些电脑方面的小技巧,包含各个方面
0 stars 0 forks source link

修复箭头bug和切换的bug(Day:48) #51

Open XJQ124 opened 8 months ago

XJQ124 commented 8 months ago

任务:修复bug


1、第一个之前一直卡住的翻转的问题解决掉了

单独为其设了一个state来控制他的这个内容

 const GitDiv = () => {
        const [expand, setExpand] = useState(null)
        const [rotate, setRotate] = useState(false)
        const [curIndex, setCurIndex] = useState(null)
        const toggle = (index) => {
            console.log('toggle', index)
            setCurIndex(index)
            setRotate(preRotate => !preRotate)
            setExpand(prevIndex => (prevIndex === index ? true : index));
        };
        //Popover里的内容以及是否可见
        const [visiblePopover, setVisiblePopover] = useState(null)
        const handlePopover = (index, visible) => {
            if (visible) {
                setVisiblePopover(index)
            } else {
                setVisiblePopover(null)
            }
        }

下面相应的也加上curIndex

   <CaretDownOutlined style={{ fontSize: 8, marginLeft: 8, marginRight: 8, transform: `rotate(${(rotate && curIndex === index) ? 180 : 0}deg)` }} />

2、第二个bug死活解决不掉,,,

改了一下午,一直出现新的问题,,,

image

image

给马老师汇报过了,这里先记录,后面这个bug先放置一下,明天的工作等待安排