Skip to content

用vue实现的虚拟滚动(提供插槽slot方式)

License

Notifications You must be signed in to change notification settings

ZerodLee/virtual-scroll-vue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

virtual-scroll-vue-slot

vue 的虚拟滚动组件

npm bundle size npm GitHub last commit (branch)

usage

  1. global component
import Vue from "vue";
import { VirtualScroll } from "virtual-scroll-vue-slot";

Vue.use(VirtualScroll);
  1. local component
<template>
  <div>
    <virtual-scroll-vue
      style="height: 200px"
      :parent="{
        tag: 'ItemsWrapper',
        props: {
          class: 'test-class',
          props: { value: vmTest },
          on: {
            input: (v) => {
              vmTest = v;
            },
          },
        },
      }"
      :items="arr"
      :itemHeight="22"
    >
      <template v-slot="item">
        <ItemOption :value="item" />
      </template>
    </virtual-scroll-vue>
  </div>
</template>

<script>
import VirtualScrollVue from "virtual-scroll-vue-slot";
import ItemOption from "./ItemOption.vue";

export default {
  name: "myDemo",
  components: { VirtualScrollVue, ItemOption },
  data() {
    return {
      vmTest: "",
      arr: Array(10000)
        .fill(null)
        .map((v, i) => i),
    };
  },
};
</script>

<style>
/* 组件样式 */
</style>

props

waiting for update...

About

用vue实现的虚拟滚动(提供插槽slot方式)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published