From ab80874fa59736505c0cce9894c9e8518fdb94db Mon Sep 17 00:00:00 2001 From: tanjinzhou <415800467@qq.com> Date: Sun, 27 Sep 2020 16:05:53 +0800 Subject: [PATCH] feat: update virtuallist --- antdv-demo | 2 +- components/vc-virtual-list/utils/CacheMap.js | 19 +++++++++++++++++++ components/vc-virtual-list/utils/isFirefox.js | 3 +++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 components/vc-virtual-list/utils/CacheMap.js create mode 100644 components/vc-virtual-list/utils/isFirefox.js diff --git a/antdv-demo b/antdv-demo index 83ab203d1..955716e4e 160000 --- a/antdv-demo +++ b/antdv-demo @@ -1 +1 @@ -Subproject commit 83ab203d1ab9861132f6efd1e74015507c0e45f6 +Subproject commit 955716e4e9533bc628c651d6ba6c8d1eb9b21a9d diff --git a/components/vc-virtual-list/utils/CacheMap.js b/components/vc-virtual-list/utils/CacheMap.js new file mode 100644 index 000000000..ffca328f7 --- /dev/null +++ b/components/vc-virtual-list/utils/CacheMap.js @@ -0,0 +1,19 @@ +// Firefox has low performance of map. +class CacheMap { + maps; + + constructor() { + this.maps = {}; + this.maps.prototype = null; + } + + set(key, value) { + this.maps[key] = value; + } + + get(key) { + return this.maps[key]; + } +} + +export default CacheMap; diff --git a/components/vc-virtual-list/utils/isFirefox.js b/components/vc-virtual-list/utils/isFirefox.js new file mode 100644 index 000000000..871180a78 --- /dev/null +++ b/components/vc-virtual-list/utils/isFirefox.js @@ -0,0 +1,3 @@ +const isFF = typeof navigator === 'object' && /Firefox/i.test(navigator.userAgent); + +export default isFF;