1.0.2 • Published 8 months ago

wang-vue-virtual-list v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

vue-auto-list

use for vue2

this is for react-auto-list

demo

fixed height

fixed height

import {VirtualList} from '.'
<VirtualList
  :list="list1"
  :itemHeight="40"
  :height="400"
  :itemKey="'id'"
  @scrollToBottom="handleBottom"
  @scroll="scroll"
  :scrollToTop="scrollToTop2"
>
  <template v-slot:header>this is header </template>
  <template v-slot:item="{ item }">
    <div
      class="inner-item"
      :style="{
        outline: '1px solid red',
        height: `40px`,
        'outline-offset': '-2px',
        'background-color': '#fff',
      }"
    >
      {{ item.index }}
    </div>
  </template>
  <template v-slot:footer>loading。。。 </template>
</VirtualList>

auto size height

fixed height

import {AutoSizeVirtualList} from '.'
<AutoSizeVirtualList
  :list="list1"
  @scrollToBottom="handleBottom"
  @scroll="scroll"
  :scrollToTop="scrollToTop2"
  :itemKey="'id'"
  :itemHeight="40"
  :height="400"
>
  <template v-slot:header>this is header </template>
  <template v-slot:item="{ item }">
    <div
      class="inner-item"
      :style="{
        outline: '1px solid red',
        height: `${item.height}px`,
        'outline-offset': '-2px',
        'background-color': '#fff',
      }"
    >
      {{ item.name }}
    </div>
  </template>
  <template v-slot:footer>loading。。。 </template>
</AutoSizeVirtualList>

auto reverse size height

fixed height

just use footer

<RevertAutoSizeVirtualList
  :list="list1"
  @scrollToBottom="handleBottom"
  @scroll="scroll"
  :scrollToTop="scrollToTop2"
  :itemKey="'id'"
  :itemHeight="40"
  :height="400"
>
  <template v-slot:item="{ item }">
    <div
      class="inner-item"
      :style="{
        outline: '1px solid red',
        height: `${item.height}px`,
        'outline-offset': '-2px',
        'background-color': '#fff',
      }"
    >
      {{ item.name }}
    </div>
  </template>
  <template v-slot:footer>loading。。。 </template>
</RevertAutoSizeVirtualList>

APIS

PropDescriptionTypeDefault
listData listArray-
heightlist heightnumber400
itemHeightlist item heightnumber40
minSizeshow cntnumber20
itemKeyitem keyskey in T-
scrollToTopgo to topnumber0
scrollToBottomscrolled to bottom(e) => void-

you can see example demo

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago