From 84b37f793614e17d169da6fd0e460086ba01b893 Mon Sep 17 00:00:00 2001 From: jeremyjone Date: Sat, 22 Apr 2023 02:28:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9Bexpand=20can=20not=20hide=20?= =?UTF-8?q?expanded=20children?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/data/row.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/models/data/row.ts b/src/models/data/row.ts index faed579..96c8d4d 100644 --- a/src/models/data/row.ts +++ b/src/models/data/row.ts @@ -2,7 +2,7 @@ * @Author: JeremyJone * @Date: 2021-09-09 15:50:52 * @LastEditors: JeremyJone - * @LastEditTime: 2023-04-22 01:17:28 + * @LastEditTime: 2023-04-22 02:26:23 * @Description: 一条数据类 */ @@ -85,7 +85,13 @@ export default class RowItem { * 获取当前数据是否应该隐藏 */ get hide() { - return !this.isExpand && this.level > 0; + if (!this.isExpand) return true; + let parent = this.parentNode; + while (parent) { + if (!parent.isExpand) return true; + parent = parent.parentNode; + } + return false; } /**