From 69da71b7c2cf1f4855158c7041d94fecb705f25e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Mon, 13 Mar 2023 09:54:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=91=E5=BD=A2=E7=BB=84=E4=BB=B6=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compenents/tree-category/index.tsx | 21 +---------------- src/compenents/tree-department/index.tsx | 23 +----------------- src/index.less | 30 ++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 42 deletions(-) diff --git a/src/compenents/tree-category/index.tsx b/src/compenents/tree-category/index.tsx index c199d11..a79b9cc 100644 --- a/src/compenents/tree-category/index.tsx +++ b/src/compenents/tree-category/index.tsx @@ -1,7 +1,6 @@ import { Button, Input, message, Tree } from "antd"; import { useState, useEffect } from "react"; import { resourceCategory } from "../../api/index"; -import type { TreeProps } from "antd/es/tree"; interface Option { key: string | number; @@ -64,18 +63,6 @@ export const TreeCategory = (props: PropInterface) => { setSelectKey(selectedKeys); }; - const onDragEnter: TreeProps["onDragEnter"] = (info) => { - console.log(info); - // expandedKeys 需要受控时设置 - // setExpandedKeys(info.expandedKeys) - }; - - const onDrop: TreeProps["onDrop"] = (info) => { - console.log(info); - // expandedKeys 需要受控时设置 - // setExpandedKeys(info.expandedKeys) - }; - return (
{ > 全部{props.text}
- +
); }; diff --git a/src/compenents/tree-department/index.tsx b/src/compenents/tree-department/index.tsx index 9f616d3..0681622 100644 --- a/src/compenents/tree-department/index.tsx +++ b/src/compenents/tree-department/index.tsx @@ -1,7 +1,6 @@ import { Button, Input, message, Tree } from "antd"; import { useState, useEffect } from "react"; import { department } from "../../api/index"; -import type { TreeProps } from "antd/es/tree"; interface Option { key: string | number; @@ -56,25 +55,5 @@ export const TreeDepartment = (props: PropInterface) => { props.onUpdate(selectedKeys); }; - const onDragEnter: TreeProps["onDragEnter"] = (info) => { - console.log(info); - // expandedKeys 需要受控时设置 - // setExpandedKeys(info.expandedKeys) - }; - - const onDrop: TreeProps["onDrop"] = (info) => { - console.log(info); - // expandedKeys 需要受控时设置 - // setExpandedKeys(info.expandedKeys) - }; - - return ( - - ); + return ; }; diff --git a/src/index.less b/src/index.less index 7dad59b..eb97095 100644 --- a/src/index.less +++ b/src/index.less @@ -327,3 +327,33 @@ textarea.ant-input { .c-gray { color: rgba(#333333, 0.3); } + +.ant-tree-treenode { + width: 100% !important; + height: 40px !important; + padding: 0 !important; + margin-bottom: 8px !important; + display: flex; + align-items: center !important; + &.ant-tree-treenode-selected { + background-color: #fff2f0 !important; + border-radius: 6px !important; + overflow: hidden; + } + &:hover { + border-radius: 6px !important; + overflow: hidden; + } + .ant-tree-node-content-wrapper-normal { + width: 100% !important; + height: 40px !important; + display: flex; + align-items: center; + + } + .ant-tree-switcher { + height: 40px !important; + display: flex; + align-items: center; + } +}