Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
577 views
in Technique[技术] by (71.8m points)

antd-mobile TextareaItem根据其他组件设置的value,为何最后拿出来是undefined的?

input3 根据input1和input2的输入设置value,value可以显示

<TextareaItem
            {...getFieldProps('input1')}
            title="input1"
            placeholder="input1"
          />
          <TextareaItem
            {...getFieldProps('input2')}
            title="input2"
            placeholder="input2"
          />
          <TextareaItem
            {...getFieldProps('input3')}
            editable={false}
            title="input3"
            placeholder=""
            value={`${getFieldValue('input1') || ''} ${getFieldValue('input2') || ''}`}
          />

最后打印表单的值,显示input3的值是undefined的。

 this.props.form.validateFields((error, values) => {

              console.log('ok', values);
          });

图片描述

图片描述


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

我这边无法复现,实测没问题。

如果有可以复现的demo,去 github 提个 issue 吧


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...