2.3.5 • Published 11 months ago

vue-virtual-scroll-list v2.3.5

Weekly downloads
65,442
License
MIT
Repository
github
Last release
11 months ago

Table of contents

Advantages

  • Only 3 required props, simple and very easy to use.

  • Big data list with high render performance and efficient.

  • You don't have to care about item size, it will calculate automatic.

Live demo

https://tangbc.github.io/vue-virtual-scroll-list

https://codesandbox.io/s/live-demo-virtual-list-e1ww1

Simple usage

npm install vue-virtual-scroll-list --save

Root component:

<template>
  <div>
    <virtual-list style="height: 360px; overflow-y: auto;" // make list scrollable
      :data-key="'uid'"
      :data-sources="items"
      :data-component="itemComponent"
    />
  </div>
</template>

<script>
  import Item from './Item'
  import VirtualList from 'vue-virtual-scroll-list'

  export default {
    name: 'root',
    data () {
      return {
        itemComponent: Item,
        items: [{uid: 'unique_1', text: 'abc'}, {uid: 'unique_2', text: 'xyz'}, ...]
      }
    },
    components: { 'virtual-list': VirtualList }
  }
</script>

Item component:

<template>
  <div>{{ index }} - {{ source.text }}</div>
</template>

<script>
  export default {
    name: 'item-component',
    props: {
      index: { // index of current item
        type: Number
      },
      source: { // here is: {uid: 'unique_1', text: 'abc'}
        type: Object,
        default () {
          return {}
        }
      }
    }
  }
</script>

More usages or getting start you can refer to these clearly examples.

Props type

Required props

             Prop             TypeDescription
data-keyString|FunctionThe unique key get from data-sources in each data object. Or a function called with each data-source and return their unique key. Its value must be unique in data-sources, it is used for identifying item size.
data-sourcesArrayObjectThe source array built for list, each array data must be an object and has an unique key get or generate for data-key property.
data-componentComponentThe render item component created / declared by vue, and it will use the data object in data-sources as render prop and named: source.

Optional props

Public methods

Attentions

This component use an in-place patch strategy to render list instead of v-for and :key. This way achieves the best efficient, but only suitable when your list output does not rely on item component inner state or temporary DOM state (e.g. form input values).

But how to deal with such a situation? Without maintaining inner state, recommend to use props and dispatch (stateless component), here is an example keep-state.

Contributions

Welcome to improve this component with any issue, pull request or code review.

Changelogs

Maintain and update occasionally, for changes see release.

License

MIT License.

ilaunchervue-cli-blockman-govue-da-spreadsheet-v2@chizhik/vue-c-uivue-da-spreadsheet@zech126/aggregatewwc-ces@infinitebrahmanuniverse/nolb-vue-vonehit-design@everything-registry/sub-chunk-3096@egova/egova-api@galaxyproject/galaxy-client@goldenm/vuetify-dual-list@hsdata/warrenq-read-tag@femessage/element-ui@femessage/log-viewer@ibizstudio/logic-design@ithinkdt/vue-virsual-treeffcs-test-bimmgitee-element-uigamechat-packagespioneer-coregcj-element-uigd_vue_componentseva-ui112evmuxel-select-virtual-scroll-listel-select2ele-tree-virtualelement-ntelement-geekokzfans-shopolading-zuidxrfx-componentsfern-selecthoney-uihbfec-imvue-virtual-selcetvue-multiselect-virtualvue-zheshiyige-projectxjj-look-uiwn-tech-uivue-tree-virtual-listvuetify-dual-listvue-draggable-virtual-scroll-listzc-vue-libzc-table-treeyf-vue-lib@94ai/nf-virtual-select@laomao800/vue-item-list-selector@marv1n/element-ui@rancher/shell@sandwich-go/cg-log-viewer@sandwich-go/log-viewer@sbc-fe/vue-virtual-table@seismic/vue-multiselect-virtual@pluto1219/el-tree-select@shuanghui/s-ui@tcpicl/el-select2@timechimp-bv/componentsawsui-vuebk-chat-toolsbig-ee-uiaiurt-vue@ulaval/modul-components@upgrade-frontend/element-ui@wakeup153/element-ui@vip30/vue-draggable-virtual-scroll-list@zhousheng193/big-aa-uiabc-common-componentscg-log-viewercomponent-businessclw-uidi-at-griddiscuz-uniappdcl-citms-uidandelion-uidraggable-virtual-list-vueinfogo-uiipmp-uiith-ui-viewlook-uisin-element-uikyui-plusmd-element-uimeeting-block-ddddmc-element-uitanma-designmy-bugsneap-uineap-ui2tanikawa-tismoblor-vuenewhope-ui2myzx-uitiptap-renderingtiptap-rendering-xiatianv-super-selectnpm-test-liuyuns-saas-ui
2.3.5

11 months ago

2.3.4

2 years ago

2.3.3

3 years ago

2.3.2

3 years ago

2.3.1

4 years ago

2.3.0

4 years ago

2.2.9

4 years ago

2.2.8

4 years ago

2.2.7

4 years ago

2.2.6

4 years ago

2.2.5

4 years ago

2.2.4

4 years ago

2.2.3

4 years ago

2.2.2

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.9

4 years ago

2.1.8

4 years ago

2.1.7

4 years ago

2.1.6

4 years ago

2.1.4

4 years ago

2.1.5

4 years ago

2.1.2

4 years ago

2.1.3

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.9

4 years ago

2.0.8

4 years ago

2.0.7

4 years ago

2.0.6

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.4.7

4 years ago

1.4.6

4 years ago

1.4.5

4 years ago

1.4.4

4 years ago

1.4.3

4 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.9

5 years ago

1.3.8

5 years ago

1.3.7

5 years ago

1.3.6

5 years ago

1.3.5

5 years ago

1.3.4

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.9

5 years ago

1.2.8

6 years ago

1.2.7

6 years ago

1.2.6

6 years ago

1.2.5

6 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.9

7 years ago

1.1.8

7 years ago

1.1.7

7 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.0

7 years ago