fix 拖动流畅度

This commit is contained in:
zwgczx committed 2026-02-26 18:04:36 +08:00
1 parent 37f4a99914
commit 57a2029847
13 files changed
+576 -64

No files matched your search

+13 -9
View File
@@ -62,7 +62,8 @@ const updateGridCardHeight = () => {
const paddingTop = style ? Number.parseFloat(style.paddingTop || '0') || 0 : 0
const paddingBottom = style ? Number.parseFloat(style.paddingBottom || '0') || 0 : 0
const nextHeight = Math.max(360, Math.floor(snapScrollHost.clientHeight - paddingTop - paddingBottom))
agGridHeight.value = nextHeight
agGridHeight.value = nextHeight+10
}
const bindSnapScrollHost = () => {
@@ -256,7 +257,7 @@ const columnDefs: ColDef<DetailRow>[] = [
return '点击输入'
}
if (params.value == null) return ''
return Number(params.value).toFixed(2)
return String(Number(params.value))
}
}
]
@@ -324,7 +325,6 @@ const saveToIndexedDB = async () => {
projectName: projectName.value,
detailRows: JSON.parse(JSON.stringify(detailRows.value))
}
console.log(payload)
await localforage.setItem(DB_KEY, payload)
} catch (error) {
console.error('saveToIndexedDB failed:', error)
@@ -407,28 +407,32 @@ const processCellFromClipboard = (params:any) => {
<template>
<div ref="rootRef" class="space-y-6">
<div class="rounded-lg border bg-card p-4 shadow-sm shrink-0">
<div class="mb-2 flex items-center justify-between gap-3">
<label class="block text-sm font-medium text-foreground">项目名称</label>
<div class="rounded-xl border bg-card p-4 shadow-sm shrink-0 md:p-5">
<div class="mb-3 flex items-center justify-between gap-3">
<div>
<label class="block text-sm font-medium text-foreground">项目名称</label>
<p class="mt-1 text-xs text-muted-foreground">该名称会用于项目级计算与展示</p>
</div>
</div>
<input
v-model="projectName"
type="text"
placeholder="请输入项目名称"
class="h-10 w-full max-w-xl rounded-md border bg-background px-3 text-sm outline-none ring-offset-background transition focus-visible:ring-2 focus-visible:ring-ring"
class="h-10 w-full max-w-6xl rounded-lg border bg-background px-4 text-sm outline-none ring-offset-background shadow-sm transition placeholder:text-muted-foreground/70 focus-visible:border-primary/60 focus-visible:ring-2 focus-visible:ring-ring"
/>
</div>
<div
ref="gridSectionRef"
class="rounded-lg border bg-card xmMx scroll-mt-3"
class="rounded-lg border bg-card xmMx scroll-mt-3 flex flex-col overflow-hidden"
:style="{ height: `${agGridHeight}px` }"
>
<div class="flex items-center justify-between border-b px-4 py-3">
<h3 class="text-sm font-semibold text-foreground">项目明细</h3>
<div class="text-xs text-muted-foreground">导入导出</div>
</div>
<div ref="agGridRef" class="ag-theme-quartz w-full" :style="{ height: `${agGridHeight}px` }">
<div ref="agGridRef" class="ag-theme-quartz w-full flex-1 min-h-0">
<AgGridVue
:style="{ height: '100%' }"
:rowData="detailRows"