From b54d1082ca442f58b4808f70eec16682c6fd07c6 Mon Sep 17 00:00:00 2001 From: xieyonghong <18010623010@163.com> Date: Mon, 16 Jan 2023 15:13:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0filterTreeSelectNode?= =?UTF-8?q?=E3=80=81filterSelectNode=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/comm.ts | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/utils/comm.ts b/src/utils/comm.ts index 9d47b987..310b4d72 100644 --- a/src/utils/comm.ts +++ b/src/utils/comm.ts @@ -35,4 +35,24 @@ export const LocalStore = { export const getToken = () => { return LocalStore.get(TOKEN_KEY) -} \ No newline at end of file +} + +/** + * TreeSelect过滤 + * @param value 过滤值 + * @param treeNode + * @param key + */ +export const filterTreeSelectNode = (value: string, treeNode: any, key: string = 'name'): boolean => { + return treeNode[key]?.includes(value) +} + +/** + * Select过滤 + * @param value 过滤值 + * @param option + * @param key + */ +export const filterSelectNode = (value: string, option: any, key: string = 'label'): boolean => { + return option[key]?.includes(value) +}