笔记笔记
  • Home
  • AI&ML
  • Example
  • Zoo
  • 关于
⌘ K
Ant Design
最佳实践
Umi UI
最后更新时间:
Copyright © 2023-2024 | Powered by dumi | GuoDapeng | 冀ICP备20004032号-1 | 冀公网安备 冀公网安备 13024002000293号

TABLE OF CONTENTS

‌
‌
‌
‌

最佳实践

Ant Design Pro

列表技巧

import type { ProColumns } from '@ant-design/pro-components';
import { ProTable } from '@ant-design/pro-components';
import Link from 'antd/es/typography/Link';
const columns: ProColumns<any>[] = [
{ title: 'ID', dataIndex: 'fa_id' },
{
title: '操作',
fixed: (typeof window !== 'undefined' ? window.innerWidth : 0) < 596 ? false : 'right',
dataIndex: 'option',
valueType: 'option',
render: (_, record) => [
<Link
key="edit"
to={{ pathname: `/fee_archives_list/info/${record.fa_id}`, state: {} }}
>
编辑
</Link>,
],
},
];
export default () => {
return <ProTable scroll={{ x: 1300 }} columns={columns}></ProTable>;
};

scroll 配合 fixed 可以实现 操作 列在 大屏幕设备 是一直显示的,在 小屏幕设备 不会挡住大部分列表内容。

表单技巧

<ProFormText
label="联系电话"
name="contact_number"
fieldProps={{ autoComplete: 'NO' }}
/>

autoComplete 设置 on off 意外的值,才能关闭浏览器的自动填充

模态框

模态框不一定遵循传统 web 页面的堆叠方式。和按钮写一起引入也能用。