Browse Source

feat: 禁止某些页面中的用户名字段相关的组件意外弹出自动填充

BaiLuoYan 1 day ago
parent
commit
ac7e0769fd
2 changed files with 7 additions and 1 deletions
  1. 1 0
      src/pages/Admin/User/components/Form.tsx
  2. 6 1
      src/pages/Admin/User/index.tsx

+ 1 - 0
src/pages/Admin/User/components/Form.tsx

@@ -76,6 +76,7 @@ export const UserForm = ({ mode, initialValues, trigger, onSuccess }: UserFormPr
         rules={[{ required: true }]}
         disabled={mode === 'edit'}
         readonly={mode === 'edit'}
+        fieldProps={{ autoComplete: 'off', id: 'user-form-name' }}
       />
       <ProFormText name="nickname" label="昵称" />
       <ProFormText name="email" label="邮箱" rules={[{ type: 'email' }]} />

+ 6 - 1
src/pages/Admin/User/index.tsx

@@ -90,7 +90,12 @@ export default function UserPage() {
   };
 
   const columns: ProColumns<API.UserItem>[] = [
-    { title: '用户名', dataIndex: 'username', width: 200 },
+    {
+      title: '用户名',
+      dataIndex: 'username',
+      width: 200,
+      fieldProps: { id: 'user-search', autoComplete: 'off' },
+    },
     { title: '昵称', dataIndex: 'nickname', width: 200 },
     {
       title: '状态',