From e74b631e0687a38f8163943cc84a8cd76a970c98 Mon Sep 17 00:00:00 2001 From: hongjli <3117313295@qq.com> Date: 星期三, 09 四月 2025 16:14:12 +0800 Subject: [PATCH] 数据演示对话框 --- src/components/DataPreviewDialog.tsx | 24 +++++++++++++++++++----- 1 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/components/DataPreviewDialog.tsx b/src/components/DataPreviewDialog.tsx index b7bb47d..ebbba51 100644 --- a/src/components/DataPreviewDialog.tsx +++ b/src/components/DataPreviewDialog.tsx @@ -62,7 +62,7 @@ </Dialog.Title> <button onClick={onClose} - className="text-gray-500 hover:text-gray-700 transition-colors duration-300" + className="text-gray-500 hover:text-gray-700 transition-colors duration-300 cursor-pointer" > <svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" /> @@ -85,11 +85,25 @@ thead: ({ node, ...props }) => ( <thead className="bg-gray-50" {...props} /> ), - th: ({ node, ...props }) => ( - <th className="px-4 py-3 text-left text-sm font-semibold text-gray-700" {...props} /> - ), + th: ({ node, children, ...props }) => { + // 鏍规嵁琛ㄥご鍐呭鍔ㄦ�佽皟鏁村搴� + let className = "px-4 py-3 text-center text-sm font-semibold text-gray-700"; + + if (typeof children === 'string') { + // 鏍规嵁琛ㄥご鍐呭璁剧疆鍚堥�傜殑瀹藉害绫� + if (children === '宸ヤ綅' || children === '鏁伴噺' || children === '搴撲綅') { + className += " w-[15%]"; + } else if (children === '鍘熸潗鏂�' || children === '鍘熸潗鏂欓渶姹�' || children === '浜х嚎鍚�') { + className += " w-[20%]"; + } else if (children === '鍘熸潗鏂欐秷鑰楅�熺巼' || children === '鐢熶骇鐨勪骇鍝�') { + className += " w-[25%]"; + } + } + + return <th className={className} {...props}>{children}</th>; + }, td: ({ node, ...props }) => ( - <td className="px-4 py-3 text-sm text-gray-600 border-t border-gray-200" {...props} /> + <td className="px-4 py-3 text-sm text-gray-600 border-t border-gray-200 text-center whitespace-nowrap" {...props} /> ), tr: ({ node, ...props }) => ( <tr className="hover:bg-gray-50 transition-colors duration-150" {...props} /> -- Gitblit v1.9.3