fix null in virtual list item (#260)

This commit is contained in:
Nolan Lawson 2018-05-03 20:41:55 -07:00 committed by GitHub
parent 1f51cfd2eb
commit b1a3be06ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,9 +30,13 @@
export default {
oncreate () {
let { key } = this.get()
let node = this.refs.node
requestAnimationFrame(() => {
if (!node || !key) {
return
}
mark('VirtualListItem gBCR')
let rect = this.refs.node.getBoundingClientRect()
let rect = node.getBoundingClientRect()
stop('VirtualListItem gBCR')
// update all item heights in one batch for better perf
this.store.batchUpdateForRealm('itemHeights', key, rect.height)