Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
550 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 Answer

0 votes
by (71.8m points)

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...