【发布时间】:2020-07-04 08:32:17
【问题描述】:
我正在使用带有 react 的 ant design mobile。
我想在 InputItem 或 TextareaItem 中提交值。
但我找不到“提交按钮”。 ;(
我可以在 ant design 中找到一个“表单”。
import React, { useCallback, useEffect, useReducer, useState } from 'react';
import useForm from 'react-hook-form';
import { Button, Icon, InputItem, List, NavBar, WhiteSpace } from 'antd-mobile';
const UserEdit = () => {
//...
return (
<form onSubmit={handleSubmit(onSubmit)}>
<ProfileContents>
<div
style={{
background: `url(/smile.png) center center / 22px 22px no-repeat`,
// marginLeft: '18pt',
}}
/>
Hello, {profile.nickName}
</ProfileContents>
<ProfileModify>
<ProfileInput>
<InputItem
style={{ backgroundColor: '#d7d7d7', borderRadius: '3.7pt' }}
placeholder={'please enter your nick name'}
onChange={handleNickNameChange}
/>
</ProfileInput>
<Button // Button in ant design mobile (<a> tag)
type={'primary'} // ant design mobile component property. not html button tag property
htmlType={'submit'} // not working
children={'Submit!'}
disabled={sending}
/>
</ProfileModify>
</form>
)
}
第一季度。如何使用 ant design mobile 以表单形式提交输入数据?
Q2。如何在反应中使用带有“useForm”的ant design mobile?
Q3。 ant design和ant design mobile可以一起用吗?
【问题讨论】:
标签: reactjs next.js antd antd-mobile