From 521e6e13789fe4195056ad686f0ba8608e6a3de9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com>
Date: Fri, 10 Mar 2023 16:47:58 +0800
Subject: [PATCH] =?UTF-8?q?=E6=A0=91=E5=BD=A2=E7=BB=84=E4=BB=B6=E5=88=9D?=
=?UTF-8?q?=E6=AD=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/compenents/tree-category/index.tsx | 24 +++++++++++++++++++++++-
src/compenents/tree-department/index.tsx | 24 +++++++++++++++++++++++-
2 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/src/compenents/tree-category/index.tsx b/src/compenents/tree-category/index.tsx
index 278a6b7..f263bdd 100644
--- a/src/compenents/tree-category/index.tsx
+++ b/src/compenents/tree-category/index.tsx
@@ -1,6 +1,8 @@
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;
title: string;
@@ -65,5 +67,25 @@ export const TreeCategory = (props: PropInterface) => {
props.onUpdate(selectedKeys);
};
- return ;
+ 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 (
+
+ );
};
diff --git a/src/compenents/tree-department/index.tsx b/src/compenents/tree-department/index.tsx
index c9e111d..9f616d3 100644
--- a/src/compenents/tree-department/index.tsx
+++ b/src/compenents/tree-department/index.tsx
@@ -1,6 +1,8 @@
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;
title: string;
@@ -54,5 +56,25 @@ export const TreeDepartment = (props: PropInterface) => {
props.onUpdate(selectedKeys);
};
- return ;
+ 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 (
+
+ );
};