From f8eb30a4c95536d7205d1e8a42bf21a12324bd12 Mon Sep 17 00:00:00 2001 From: zsmj Date: Mon, 17 Oct 2022 13:55:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0JRIA=20fix:=20destoryed=E5=89=8D?= =?UTF-8?q?=E9=87=8A=E6=94=BEResizeDetector?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/list/listview.js | 3 ++- src/base/list/virtualgrouplist.js | 5 +++++ src/base/list/virtuallist.js | 8 ++++---- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/base/list/listview.js b/src/base/list/listview.js index 7028132bc..9939adfbb 100644 --- a/src/base/list/listview.js +++ b/src/base/list/listview.js @@ -128,7 +128,8 @@ BI.ListView = BI.inherit(BI.Widget, { this._populate(items); }, - destroyed: function () { + beforeDestroy: function () { + BI.ResizeDetector.removeResizeListener(this); this.restore(); }, }); diff --git a/src/base/list/virtualgrouplist.js b/src/base/list/virtualgrouplist.js index 34b11e800..d32dc3a58 100644 --- a/src/base/list/virtualgrouplist.js +++ b/src/base/list/virtualgrouplist.js @@ -181,6 +181,11 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, { populate: function (items) { this._populate(items); }, + + beforeDestroy: function () { + BI.ResizeDetector.removeResizeListener(this); + this.restore(); + } }); BI.shortcut("bi.virtual_group_list", BI.VirtualGroupList); diff --git a/src/base/list/virtuallist.js b/src/base/list/virtuallist.js index 2715008cb..3c110b637 100644 --- a/src/base/list/virtuallist.js +++ b/src/base/list/virtuallist.js @@ -201,10 +201,10 @@ BI.VirtualList = BI.inherit(BI.Widget, { this._populate(items); }, - destroyed: function () { - this.cache = {}; - this.renderedIndex = -1; - }, + beforeDestroy: function () { + BI.ResizeDetector.removeResizeListener(this); + this.restore(); + } }); BI.shortcut("bi.virtual_list", BI.VirtualList);