vue-launchers
launcher
1,558
| Install | |
|---|---|
npm install vue-launchers |
|
| Latest Version: | 1.0.45 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | May 30, 2025 |
| Links: | Gitee · npm |
Maintainer: the_distant_dream
vue-virtual-list-xg
virtual list component for Vue3
源码
live demo is here: https://gitee.com/derekgo/tool-collection/tree/master/virtualList/vue3
安装
npm i vue-virtual-list-xg --save
使用
main.ts
// script
import { createApp } from 'vue';
import App from './App.vue';
import virtualList from "vue-virtual-list-xg"
import "vue-virtual-list-xg/lib/style.css"
createApp(App).use(virtualList).mount('#app')
App.vue
<template>
<div class="app-container">
<virtualList :data="data" class="u-f u-f-spa u-f-aja" :columns="15" :containerHeight="virtualListHeight" >
<template #default="row">
{{row.data}}
</template>
</virtualList>
</div>
</template>
<script setup lang="ts">
import {defineAsyncComponent, onMounted, ref} from "vue";
let once = ref(0)//每次插入的数量
let total = ref(0)//总条数
let countRender = ref(0)//已经渲染次数
let loopCount = ref(0)//需要插入的次数
let data = ref<any>([])
let virtualListHeight = ref("")
const handleInit = () => {
data.value.length = 0;
setTimeout(()=>{
// 百万条数据
total.value = 100;
// 单次插入 可自定义
once.value = 20;
// 需要插入的次数 向上取整
loopCount.value = Math.ceil(total.value / once.value);
// 当前渲染次数
countRender.value = 0;
handleRender();
},500)
}
//百万数据分段插入
const handleRender = () => {
for (let i = 0; i < once.value; i++) {
data.value.push({id:countRender.value+'-'+i})
}
// 渲染次数加1,控制递归的次数
countRender.value++;
let windowsObj = window as any
if (countRender.value < loopCount.value) {
windowsObj.requestAnimationFrame(handleRender);
}
}
onMounted(()=>{
virtualListHeight.value = (document.documentElement.offsetHeight-400)+"px"
handleInit()
})
</script>
<style scoped lang="less">
.app-container{
background-color: gray;
height:500px;
width: 500px;
}
.listItem{
border-bottom:1px solid red;
padding:10px;
}
</style>
<style lang="less">
/* flex布局 */
.u-f,
.u-f-ac {
flex-shrink:0;//给flex布局添加固定宽度
display: flex!important;
}
.u-f-ac,
.u-f-ajc {
align-items: center;
}
/* 水平方向居中 */
.u-f-ajc {
justify-content: center;
}
.u-f-ajs {
justify-content: space-between;
}
.u-f-aja {
justify-content: space-around;
}
.u-f-spa{
flex-direction: row;
flex-wrap: wrap;
}
</style>
Related Packages
markdown-to-jsx
A very fast and versatile markdown toolchain. AST, React, React Native, SolidJS,...
214,042,213
2,394
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 1.0.45 | ^3.2.47 | MIT | |
| 1.0.44 | ^3.2.47 | MIT | |
| 1.0.43 | ^3.2.47 | MIT | |
| 1.0.42 | ^3.2.47 | MIT | |
| 1.0.41 | ^3.2.47 | MIT | |
| 1.0.40 | ^3.2.47 | MIT | |
| 1.0.38 | ^3.2.47 | MIT | |
| 1.0.37 | ^3.2.47 | MIT | |
| 1.0.36 | ^3.2.47 | MIT | |
| 1.0.35 | ^3.2.47 | MIT | |
| 1.0.34 | ^3.2.47 | MIT | |
| 1.0.33 | ^3.2.47 | MIT | |
| 1.0.32 | ^3.2.47 | MIT | |
| 1.0.31 | ^3.2.47 | MIT | |
| 1.0.30 | ^3.2.47 | MIT | |
| 1.0.29 | ^3.2.47 | MIT | |
| 1.0.28 | ^3.2.47 | MIT | |
| 1.0.27 | ^3.2.47 | MIT | |
| 1.0.26 | ^3.2.47 | MIT | |
| 1.0.25 | ^3.2.47 | MIT | |
| 1.0.24 | ^3.2.47 | MIT | |
| 1.0.23 | ^3.2.47 | MIT | |
| 1.0.21 | ^3.2.47 | MIT | |
| 1.0.20 | ^3.2.47 | MIT | |
| 1.0.19 | ^3.2.47 | MIT | |
| 1.0.18 | ^3.2.47 | MIT | |
| 1.0.17 | ^3.2.47 | MIT | |
| 1.0.16 | ^3.2.47 | MIT | |
| 1.0.15 | ^3.2.47 | MIT | |
| 1.0.14 | ^3.2.47 | MIT |
Showing the latest 30 of 44. See every release on npm