{"id":25098332,"url":"https://github.com/supercll/vue3-virtual-scroll-list","last_synced_at":"2025-07-19T20:36:04.374Z","repository":{"id":184434219,"uuid":"671834028","full_name":"supercll/vue3-virtual-scroll-list","owner":"supercll","description":"vue3 虚拟滚动列表组件，可自定义列表样式","archived":false,"fork":false,"pushed_at":"2023-07-31T07:28:33.000Z","size":33,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-07T18:51:32.122Z","etag":null,"topics":["component","typescript","virtual-scroll","vue3"],"latest_commit_sha":null,"homepage":"","language":"Vue","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/supercll.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-28T08:41:41.000Z","updated_at":"2023-07-31T07:23:06.000Z","dependencies_parsed_at":"2025-02-07T18:44:55.889Z","dependency_job_id":null,"html_url":"https://github.com/supercll/vue3-virtual-scroll-list","commit_stats":null,"previous_names":["supercll/vue3-virtual-scroll-list"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supercll%2Fvue3-virtual-scroll-list","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supercll%2Fvue3-virtual-scroll-list/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supercll%2Fvue3-virtual-scroll-list/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supercll%2Fvue3-virtual-scroll-list/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/supercll","download_url":"https://codeload.github.com/supercll/vue3-virtual-scroll-list/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246752656,"owners_count":20827987,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["component","typescript","virtual-scroll","vue3"],"created_at":"2025-02-07T18:31:05.054Z","updated_at":"2025-04-02T04:10:36.306Z","avatar_url":"https://github.com/supercll.png","language":"Vue","funding_links":[],"categories":[],"sub_categories":[],"readme":"## install\n\n```\npnpm i vue3-virtual-scroll-list-component\nor\nnpm i vue3-virtual-scroll-list-component\n```\n\n## use\n\n```Vue\n\u003ctemplate\u003e\n  \u003cdiv style=\"height: 600px;\"\u003e\n    \u003cVirtualScrollList :source-data=\"accountData\" :item-height=\"90\" v-slot=\"slotProps\"\u003e\n      \u003ctemplate v-for=\"(item, index) in (slotProps.viewList as AccountDataItem[])\" :key=\"item.id\"\u003e\n        \u003cdiv class=\"list-itembox\" :style=\"`height: ${slotProps.itemHeight}px`\"\u003e\n          \u003cp class=\"action\"\n            :style=\"{ backgroundColor: index % 2 === 0 ? '#f2ddde' : '#dff1d8', color: index % 2 === 0 ? '#ae8286' : '#8ea189' }\"\u003e\n            \u003cspan class=\"date\"\u003e\n              {{ item.date }}\n            \u003c/span\u003e\n            \u003cbutton class=\"delete\" @click=\"deleteItem(item.id)\"\u003e删除\u003c/button\u003e\n          \u003c/p\u003e\n          \u003cdiv class=\"info\"\u003e\n            \u003cp class=\"nanoid\"\u003e{{ item.id }}\u003c/p\u003e\n            \u003cp class=\"detail\"\u003e{{ item.detail }}\u003c/p\u003e\n            \u003cp class=\"state\"\u003e\u003cspan v-if=\"item.state\"\u003e支出\u003c/span\u003e\u003cspan v-else\u003e收入\u003c/span\u003e\u003c/p\u003e\n            \u003cp class=\"money\"\u003e{{ item.money }}元\u003c/p\u003e\n          \u003c/div\u003e\n        \u003c/div\u003e\n      \u003c/template\u003e\n\n    \u003c/VirtualScrollList\u003e\n  \u003c/div\u003e\n\u003c/template\u003e\n​\n\u003cscript lang=\"ts\" setup\u003e\nimport { ref, reactive, onMounted, Ref, defineComponent } from 'vue'\nimport { nanoid } from 'nanoid'\nimport VirtualScrollList from 'vue3-virtual-scroll-list-component'\nimport 'vue3-virtual-scroll-list-component/css'\n\ndefineComponent({\n  VirtualScrollList\n})\n\ninterface AccountDataItem {\n  date: string //日期\n  state: number //收支状态 0为收入 1为支出\n  detail: string //详情\n  money: number //花费或收入\n  id: string,\n}\n//原始数据\nconst accountData = ref\u003cAccountDataItem[]\u003e([])\n\n\n//获取原始数据\nconst getData = (): Promise\u003cAccountDataItem[]\u003e =\u003e {\n  const data: AccountDataItem[] = []\n  return new Promise(resolve =\u003e {\n    for (let i = 0; i \u003c 10000; i++) {\n      data.push(\n        {\n          date: `2023-03-28`,\n          id: nanoid(),\n          state: 0,\n          detail: `ACG${i}`,\n          money: 1800\n        },\n        {\n          date: `2023-03-29`,\n          id: nanoid(),\n          state: 1,\n          detail: `ACG${i}`,\n          money: 2000\n        })\n    }\n    resolve(data)\n  })\n}\nconst deleteItem = (targetId) =\u003e {\n  accountData.value = accountData.value.filter(item =\u003e item.id !== targetId)\n\n}\nonMounted(async () =\u003e {\n  accountData.value = await getData()\n})\n\u003c/script\u003e\n​\n\u003cstyle scoped lang='scss'\u003e\np {\n  margin: 0;\n  padding: 0;\n}\n\n#main-bg {\n  margin: 0 auto;\n}\n\n\n.list-itembox {\n  margin: 10px 0;\n  border: 1px #EEEEEE solid;\n  border-radius: 8px;\n  width: 70vw;\n\n  .action {\n    display: flex;\n    justify-content: space-between;\n    align-items: center;\n    padding: 0 5px;\n  }\n\n  .date {\n    font-size: 14px;\n    line-height: 14px;\n    padding: 10px;\n  }\n\n  .delete {\n    font-size: 12px;\n    line-height: 18px;\n    height: 18px;\n    width: 38px;\n    padding: 0 5px;\n    color: white;\n    background-color: red;\n\n  }\n\n  .info {\n    display: grid;\n    grid-template-columns: 80px auto auto auto;\n    justify-content: space-between;\n    font-size: 15px;\n    line-height: 15px;\n    text-align: left;\n    padding: 10px 15px;\n\n  }\n}\n\u003c/style\u003e\n​\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsupercll%2Fvue3-virtual-scroll-list","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsupercll%2Fvue3-virtual-scroll-list","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsupercll%2Fvue3-virtual-scroll-list/lists"}