fix null in virtual list item (#260)
This commit is contained in:
		
							parent
							
								
									1f51cfd2eb
								
							
						
					
					
						commit
						b1a3be06ff
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
					@ -30,9 +30,13 @@
 | 
				
			||||||
  export default {
 | 
					  export default {
 | 
				
			||||||
    oncreate () {
 | 
					    oncreate () {
 | 
				
			||||||
      let { key } = this.get()
 | 
					      let { key } = this.get()
 | 
				
			||||||
 | 
					      let node = this.refs.node
 | 
				
			||||||
      requestAnimationFrame(() => {
 | 
					      requestAnimationFrame(() => {
 | 
				
			||||||
 | 
					        if (!node || !key) {
 | 
				
			||||||
 | 
					          return
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        mark('VirtualListItem gBCR')
 | 
					        mark('VirtualListItem gBCR')
 | 
				
			||||||
        let rect = this.refs.node.getBoundingClientRect()
 | 
					        let rect = node.getBoundingClientRect()
 | 
				
			||||||
        stop('VirtualListItem gBCR')
 | 
					        stop('VirtualListItem gBCR')
 | 
				
			||||||
        // update all item heights in one batch for better perf
 | 
					        // update all item heights in one batch for better perf
 | 
				
			||||||
        this.store.batchUpdateForRealm('itemHeights', key, rect.height)
 | 
					        this.store.batchUpdateForRealm('itemHeights', key, rect.height)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue