Reactjs 如何在React JS中关闭表单后保持工具提示的可见性

Reactjs 如何在React JS中关闭表单后保持工具提示的可见性,reactjs,tooltip,bootstrap-modal,antd,Reactjs,Tooltip,Bootstrap Modal,Antd,我使用工具提示在我的表单中显示验证消息(这是一种模式)。 我在表单中有一个取消按钮。单击“取消”按钮(下图中不包含“取消”按钮)并重定向到“索引”页面时,工具提示仍保留在“索引”页面中,如图所示: form.js中用于工具提示的代码 <div style={{ 'height': '46px', 'display': 'flex'}}> <label style={{ 'color': '#f5222d', 'paddingTop': '10px', 'fontFami

我使用工具提示在我的表单中显示验证消息(这是一种模式)。

我在表单中有一个取消按钮。单击“取消”按钮(下图中不包含“取消”按钮)并重定向到“索引”页面时,工具提示仍保留在“索引”页面中,如图所示:

form.js中用于工具提示的代码

<div style={{ 'height': '46px', 'display': 'flex'}}>
  <label style={{ 'color': '#f5222d', 'paddingTop': '10px', 'fontFamily': 'SimSun'}}>*</label>&nbsp;
  <label style={{ 'width': '70px', 'paddingTop': '8px'}}>Customer Name:</label>
  <FormItem>
    {getFieldDecorator('Name', { initialValue: '', rules: [{ required: true, message: (
    <Tooltip visible={true} placement="topRight" title="Please Input Customer Name" /> ), }], })(
    <Input placeholder="Customer Name" style={{ 'width': '164px'}} onChange={(e)=>{e.preventDefault(); e.stopPropagation(); this.handleChange(0,e, 'Name')}}/> )}
  </FormItem>
</div>

有没有办法解决这个问题?有人能帮我吗?

关于handleModelCancel函数,您需要为工具提示编写一个逻辑,即您需要为工具提示执行visible false 传递值为布尔值的变量(例如:

`<Tooltip visible={this.state.isTooltipVisible}>`
``
使handleModelCancel函数中的ISTOLTIPVISIBLE值为false

希望对你有帮助

`<Tooltip visible={this.state.isTooltipVisible}>`