• react使用react-split-pane分割面板


    react使用react-split-pane分割面板

    • 安装:npm i react-split-pane

    code.jsx

    import React, { useState, useEffect } from "react";
    import StyleDeptId from "styled-components";
    import SplitPane from 'react-split-pane';
    import "./splitSpane.scss";
    import SearchDept from "./searchDept"
    export default function Dept(props) {
      const [loading, setLoading] = useState(false);
      useEffect(() => {
        // init();
      }, []);
    
      return (
        <DeptWrap className="wrap">
          {/* {
              width: '100%',
              height: "100%",
            }}
          > */}
          <SplitPane split="vertical" minSize={200} defaultSize={200}>
            <div className="left">
              <SearchDept></SearchDept>
            </div>
            <div className="right">right</div>
          </SplitPane>
        </DeptWrap>
      );
    }
    
    const DeptWrap = StyleDeptId.div`
    display: flex;
    height: 100%;
    background: #ccc;
    position: relative;
    .left {
      background: pink;
      height: 100%;
    }
    .right {
      background: orange;
      height: 100%;
    }
    `;
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45

    splitSpane.scss

    // react-split-pane的样式必须要
    .Resizer {
      background: #000;
      opacity: 0.2;
      z-index: 1;
      -moz-box-sizing: border-box;
      -webkit-box-sizing: border-box;
      box-sizing: border-box;
      -moz-background-clip: padding;
      -webkit-background-clip: padding;
      background-clip: padding-box;
    }
    
    .Resizer:hover {
      -webkit-transition: all 2s ease;
      transition: all 2s ease;
    }
    
    .Resizer.horizontal {
      height: 11px;
      margin: -5px 0;
      border-top: 5px solid rgba(255, 255, 255, 0);
      border-bottom: 5px solid rgba(255, 255, 255, 0);
      cursor: row-resize;
      width: 100%;
    }
    
    .Resizer.horizontal:hover {
      border-top: 5px solid rgba(0, 0, 0, 0.5);
      border-bottom: 5px solid rgba(0, 0, 0, 0.5);
    }
    
    .Resizer.vertical {
      width: 11px;
      margin: 0 -5px;
      border-left: 5px solid rgba(255, 255, 255, 0);
      border-right: 5px solid rgba(255, 255, 255, 0);
      cursor: col-resize;
    }
    
    .Resizer.vertical:hover {
      border-left: 5px solid rgba(0, 0, 0, 0.5);
      border-right: 5px solid rgba(0, 0, 0, 0.5);
    }
    .Resizer.disabled {
      cursor: not-allowed;
    }
    .Resizer.disabled:hover {
      border-color: transparent;
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
  • 相关阅读:
    注解@EnableAutoConfiguration的作用以及如何使用
    SVN报错fail to run the WC Db work queue associated with,清理失败,乱码的解决方式
    序列号读取
    vue中关闭eslint的检测,eslint的配置,及格式化文件时的配置
    数据结构基础--栈和队列
    UiPath快捷键
    unity pivot and center
    靶场上新:Openfire身份认证绕过
    Python 编程基础 | 第一章-预备知识 | 1.4、包管理工具
    【Spring Boot 3】【JPA】多对一单向关联
  • 原文地址:https://blog.csdn.net/weixin_43845137/article/details/132787531