优化参数配置,简化组件构建
This commit is contained in:
13
src/App.vue
13
src/App.vue
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import ProjectList from './components/ProjectList.vue'
|
||||
import type { ListItem, MenuItem, ListConfig } from '@/types'
|
||||
import type { ListItem, MenuItem } from '@/types'
|
||||
|
||||
// 生成模拟数据
|
||||
const listData: ListItem[] = Array.from({ length: 789 }, (_, i) => ({
|
||||
@@ -15,14 +15,6 @@ const listData: ListItem[] = Array.from({ length: 789 }, (_, i) => ({
|
||||
]
|
||||
}))
|
||||
|
||||
// 自定义配置
|
||||
const listConfig: ListConfig = {
|
||||
itemHeight: 50,
|
||||
itemPadding: 16,
|
||||
bufferCount: 10,
|
||||
scrollDebounceTime: 16,
|
||||
}
|
||||
|
||||
// 自定义菜单项
|
||||
const menuItems: MenuItem[] = [
|
||||
{
|
||||
@@ -57,10 +49,7 @@ const handleItemClick = (item: ListItem): void => {
|
||||
<template>
|
||||
<ProjectList
|
||||
:data="listData"
|
||||
:config="listConfig"
|
||||
:menu-items="menuItems"
|
||||
:show-toolbar="true"
|
||||
:toolbar-height="40"
|
||||
@click="handleItemClick"
|
||||
/>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user