arco-design / arco-design

A comprehensive React UI components library based on Arco Design
https://arco.design
MIT License
4.95k stars 666 forks source link

期望form.item的tooltip配置自动阻止与表单项的联动 #2767

Open eveningwater opened 3 months ago

eveningwater commented 3 months ago

Basic Info

What are the similar cases of this feature

https://arco.design/react/components/form#%E8%A1%A8%E5%8D%95%E5%B8%83%E5%B1%80

What problem does this feature solve?

tooltip配置默认不应该与表单项联动,这只是一个描述信息,仅供展示的。

yinkaihui commented 3 months ago

参考这里吧:https://arco.design/react/components/form#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98

image
eveningwater commented 3 months ago

参考这里吧:https://arco.design/react/components/form#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98

image

跟我描述的有差异,这里是需要保留点击label与表单项的联动,tooltip配置(也是被包含在label里面的),这里只是想要将tooltip与表单联动的行为去掉。类似代码如下:

<Form.Item
    field="sound_switch"
    triggerPropName="checked"
    label=" "
    tooltip={{
         content: (
            <Link href={newWorkGuideUrl} target="_blank" hoverable={false} style={{ color: '#fff' }}>
              新工单通知指南?
            </Link>
         ),
         // 也就是这里的处理期望由组件库这边来完成,而不是由用户来处理
         onClick: (e: Event) => {
           e.preventDefault();
         },
    }}
>
     <Switch checkedText="新工单通知" uncheckedText="新工单通知" />
</Form.Item>