mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-14 01:11:25 +08:00
45 lines
821 B
Vue
45 lines
821 B
Vue
|
<template>
|
||
|
<ul v-infinite-scroll="load" class="infinite-list" style="overflow: auto">
|
||
|
<li v-for="i in count" :key="i" class="infinite-list-item">{{ i }}</li>
|
||
|
</ul>
|
||
|
</template>
|
||
|
|
||
|
<script lang="ts">
|
||
|
import { defineComponent, ref } from 'vue'
|
||
|
|
||
|
export default defineComponent({
|
||
|
setup() {
|
||
|
const count = ref(0)
|
||
|
const load = () => {
|
||
|
count.value += 2
|
||
|
}
|
||
|
return {
|
||
|
count,
|
||
|
load,
|
||
|
}
|
||
|
},
|
||
|
})
|
||
|
</script>
|
||
|
|
||
|
<style lang="scss">
|
||
|
.infinite-list {
|
||
|
height: 300px;
|
||
|
padding: 0;
|
||
|
margin: 0;
|
||
|
list-style: none;
|
||
|
|
||
|
.infinite-list-item {
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
justify-content: center;
|
||
|
height: 50px;
|
||
|
background: var(--el-color-primary-light-9);
|
||
|
margin: 10px;
|
||
|
color: var(--el-color-primary);
|
||
|
& + .list-item {
|
||
|
margin-top: 10px;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</style>
|