How does the ELEMENT-UI a Table scroll effect?

This article mainly introduces the Element-UI how to operate the Table rolling effect, the introduction of the text is very detailed, with a certain reference value, interested partners must have read!

Add global registration event to listen to rolling events

  Window.Vue.directive ('loadMore', {Bind (EL, BINDING ) {const selectWrap = el.querySelector ( '. el-tablebody-wrapper') selectWrap.addEventListener ( 'scroll', function () {let sign = 100 const scrollDistance = this.scrollHeight - this.scrollTop - this.clientHeight if ( ScrollDistance <= sign) {
  binding.value()
  }
 })
 }
}) 
SIGN is used for marking position

to let ScrollDistance === siGN do not guarantee that each time is triggered, so use the interval. Subsequent processing Frequent problem.

Add event

Add a custom event to a wireless load, V-loadMore = “loadMore”. Defined in Methods Triggering event

LoadMore () {if (this.loadsign) {this.loadsign = false this.page ++ if (this.page> 10) {return} settimeout (() = > {this.loadsign = true},1000) Console.log (‘in the end’, this.page)}}
   THISLOADSIGN is used to mark the PAGE Continue 
or more ELEMENT-UI How do I operate all the contents of the Table scrolling effect, thank you for reading! The content that wants to share is helpful to everyone, more related knowledge, welcome to pay attention to Tumi Yun Industry News Channel!

© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment