-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5ce15cd
commit 71a719d
Showing
12 changed files
with
266 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import React from 'react' | ||
import { Button, Form, Input, Radio, Space } from '@nutui/nutui-react' | ||
|
||
type FieldType = { account?: string; loginMethod?: 'mobile' | 'email' } | ||
|
||
const Demo8 = () => { | ||
const [form] = Form.useForm<FieldType>() | ||
const account = Form.useWatch('account', form) | ||
const loginMethod = Form.useWatch('loginMethod', form) | ||
|
||
return ( | ||
<Form | ||
form={form} | ||
initialValues={{ loginMethod: 'mobile', account: '123' }} | ||
footer={ | ||
<> | ||
<div | ||
style={{ | ||
width: '100%', | ||
}} | ||
> | ||
<div | ||
style={{ | ||
fontSize: '12px', | ||
textAlign: 'center', | ||
marginBottom: '20px', | ||
}} | ||
> | ||
你将使用 {loginMethod === 'mobile' ? '手机号' : '邮箱'} {account}{' '} | ||
登录 | ||
</div> | ||
<Button block type="primary" size="large" nativeType="submit"> | ||
提交 | ||
</Button> | ||
</div> | ||
</> | ||
} | ||
> | ||
<Form.Item name="loginMethod" label="登录方式"> | ||
<Radio.Group> | ||
<Space> | ||
<Radio value="mobile">手机号</Radio> | ||
<Radio value="email">邮箱</Radio> | ||
</Space> | ||
</Radio.Group> | ||
</Form.Item> | ||
|
||
<> | ||
{loginMethod === 'mobile' && ( | ||
<Form.Item name="account" label="手机号"> | ||
<Input placeholder="请输入手机号" /> | ||
</Form.Item> | ||
)} | ||
{loginMethod === 'email' && ( | ||
<Form.Item name="account" label="邮箱"> | ||
<Input placeholder="请输入邮箱" /> | ||
</Form.Item> | ||
)} | ||
</> | ||
</Form> | ||
) | ||
} | ||
|
||
export default Demo8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import React from 'react' | ||
import { Button, Form, Input, Radio, Space } from '@nutui/nutui-react-taro' | ||
|
||
type FieldType = { account?: string; loginMethod?: 'mobile' | 'email' } | ||
|
||
const Demo8 = () => { | ||
const [form] = Form.useForm<FieldType>() | ||
const account = Form.useWatch('account', form) | ||
const loginMethod = Form.useWatch('loginMethod', form) | ||
|
||
return ( | ||
<Form | ||
form={form} | ||
initialValues={{ loginMethod: 'mobile', account: '123' }} | ||
footer={ | ||
<> | ||
<div | ||
style={{ | ||
width: '100%', | ||
}} | ||
> | ||
<div | ||
style={{ | ||
fontSize: '12px', | ||
textAlign: 'center', | ||
marginBottom: '20px', | ||
}} | ||
> | ||
你将使用 {loginMethod === 'mobile' ? '手机号' : '邮箱'} {account}{' '} | ||
登录 | ||
</div> | ||
<Button block type="primary" size="large" nativeType="submit"> | ||
提交 | ||
</Button> | ||
</div> | ||
</> | ||
} | ||
> | ||
<Form.Item name="loginMethod" label="登录方式"> | ||
<Radio.Group> | ||
<Space> | ||
<Radio value="mobile">手机号</Radio> | ||
<Radio value="email">邮箱</Radio> | ||
</Space> | ||
</Radio.Group> | ||
</Form.Item> | ||
|
||
<> | ||
{loginMethod === 'mobile' && ( | ||
<Form.Item name="account" label="手机号"> | ||
<Input placeholder="请输入手机号" /> | ||
</Form.Item> | ||
)} | ||
{loginMethod === 'email' && ( | ||
<Form.Item name="account" label="邮箱"> | ||
<Input placeholder="请输入邮箱" /> | ||
</Form.Item> | ||
)} | ||
</> | ||
</Form> | ||
) | ||
} | ||
|
||
export default Demo8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.