This commit is contained in:
2024-10-15 18:01:13 +08:00
parent cede0eca22
commit 036ef5dc1a
3 changed files with 18 additions and 8 deletions

View File

@@ -53,7 +53,7 @@
"rollup-plugin-visualizer": "^5.12.0",
"tailwindcss": "^3.4.13",
"typescript": "^5.6.3",
"vite": "^5.4.8"
"vite": "^5.4.9"
}
},
"node_modules/@alloc/quick-lru": {
@@ -5529,9 +5529,9 @@
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
},
"node_modules/vite": {
"version": "5.4.8",
"resolved": "https://registry.npmmirror.com/vite/-/vite-5.4.8.tgz",
"integrity": "sha512-FqrItQ4DT1NC4zCUqMB4c4AZORMKIa0m8/URVCZ77OZ/QSNeJ54bU1vrFADbDsuwfIPcgknRkmqakQcgnL4GiQ==",
"version": "5.4.9",
"resolved": "https://registry.npmmirror.com/vite/-/vite-5.4.9.tgz",
"integrity": "sha512-20OVpJHh0PAM0oSOELa5GaZNWeDjcAvQjGXy2Uyr+Tp+/D2/Hdz6NLgpJLsarPTA2QJ6v8mX2P1ZfbsSKvdMkg==",
"dev": true,
"license": "MIT",
"dependencies": {

View File

@@ -56,6 +56,6 @@
"rollup-plugin-visualizer": "^5.12.0",
"tailwindcss": "^3.4.13",
"typescript": "^5.6.3",
"vite": "^5.4.8"
"vite": "^5.4.9"
}
}

View File

@@ -35,7 +35,11 @@
</div>
<a-spin :loading="loading" tip="解析word完成正在渲染界面..." :style="{ width: '100%' }">
<div class="demand-container">
<a-list :data="htmlData" :pagination-props="{ defaultPageSize: 15, total: htmlData.length }">
<a-list
@page-change="handlePageChange"
:data="htmlData"
:pagination-props="{ defaultPageSize: 15, total: htmlData.length }"
>
<template #item="{ item, index }">
<a-list-item>
<div class="item-container">
@@ -193,9 +197,15 @@ const handledownCreate = (index) => {
const newDemand = JSON.parse(JSON.stringify(templateDemandObj))
htmlData.value.splice(index + 1, 0, newDemand)
}
// 点击单条右侧按钮:删除
// 因为a-list限制必须知道当前页码和页容量
const currentPage = ref(1)
const handlePageChange = (page) => {
currentPage.value = page
}
// 点击单条右侧按钮:删除 - 需要根据currentPage动态觉得因为a-list每页都是这样计算的
const handleDelete = (index) => {
htmlData.value.splice(index, 1)
const currentIndex = index + (currentPage.value - 1) * 15
htmlData.value.splice(currentIndex, 1)
}
// 打开弹窗并初始化form数据
const open = function () {