在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ react顯示/隱藏

react顯示/隱藏

clipboard.png

clipboard.png
新增頂級的時候沒有上級菜單ID,讓它隱藏
此處我用的是一個modal框

<Button icon="plus" type="primary" onClick={() => this.handleModalVisibleAdd(record)}>
  新增頂級
</Button>
<Form>
  {/* {this.props.data.PARENT_ID ? (
    <FormItem
      {...formItemLayout}
      label="上級菜單ID"
    >
      {getFieldDecorator('PARENT_ID', {
        initialValue: this.props.data.ID,
        rules: [{
          // required: true, message: '請輸入菜單名稱',
        }],
      })(
        <Input disabled />
      )}
    </FormItem>
  ) : null
  } */}

......

 </Form>

貼了部分代碼,實現(xiàn)有些問題
請問該怎么弄

回答
編輯回答
凹凸曼

單擊按鈕的時候設(shè)置一個state值標識。
Modal中通過這個標識來判斷。通過三目運算符或者 && 都可以實現(xiàn)。

2018年7月14日 10:25
編輯回答
你的瞳
<Form>
          {this.props.data.PARENT_ID && (
            <FormItem {...formItemLayout} label="上級菜單ID">
              {getFieldDecorator('PARENT_ID', {
                initialValue: this.props.data.ID, rules: [{}],
              })(
                <Input disabled/>
              )}
            </FormItem>
          )}
        </Form>

是這個意思么? 想用 this.props.data.PARENT_ID控制你的input ?

2017年1月20日 14:33