New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

virtual-list-engine

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

virtual-list-engine

virtualListEngine

latest
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

使用方法

  • 安装
npm install virtual-list-engine --save
  • 项目中引入
// example.vue
<div class="oa-list" id="oa-list">
      <div>
        <div
          v-for="(item, index) in renderList"
          :key="index">
            ......
        </div>
      </div>
 </div>
<script>
   import virtuaListEngine from 'virtual-list-engine'
	 export default{
     data(){
       return{
         pageOpt: {
          pageSize: 15,
          pageNo: 1,
        },
        virtuaListEngine: null,
        allList: [],
       }
     },
     ...
     mounted() {
      this.virtuaListEngine = new VirtuaListEngine('#oa-list', this.pageOpt, this.getList)
     },
     computed: {
      pointer() {
        return {
          start: this.virtuaListEngine ? this.virtuaListEngine.pointer.start : 0,
          end: this.virtuaListEngine ? this.virtuaListEngine.pointer.end : 0,
        }
      },
      renderList() {
        return this.oaList.slice(this.pointer.start, this.pointer.end)
      },
    },
    method:{
      // 列表数据获取方法 pageOpt={pageSize,pageNo}
      getList(notice,pageOpt){
        ...
        this.allList = this.allList.concat(data.data.rows)
        notice && notice(this.allList.length)
        ...
      },
     destroyed() {
      this.virtuaListEngine.destroy()
    },
   }
</script>


  • 实例属性
  • virtuaListEngine.pointer
 {
    prev: 0, // 上一代指针的开始指针
    start: 0, // 开始指针
    end: 10, // 结束指针
    next: 0, // 下一代指针的结束指针
  }
  • 实例方法
  • virtuaListEngine.resetPointer() :将指针移动到初始位置

  • virtuaListEngine.destroy() :销毁实例的滚动条监听

Keywords

virtualListEngine

FAQs

Package last updated on 04 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts