Comments (8)
from ant-design.
HOC 传入,status。自定义元素的属性不一定也叫 status
:
const MyInput = ({ checkStatus, className, ...props }) => {
return <input className={classNames(className, `my-status-${status}`)} {...props} />
};
from ant-design.
自行封装 AutoComplete 后,你可以同时把 status 传给需要的地方:
// 参考你的 PR,封装业务组件。而不是写死在 antd 中
const MyAutoComplete = ({ status, ...props }) => (
<AutoComplete {...props} status={status}>
{cloneElement(...)}
</AutoComplete>
);
from ant-design.
自行封装 AutoComplete 后,你可以同时把 status 传给需要的地方:
// 参考你的 PR,封装业务组件。而不是写死在 antd 中 const MyAutoComplete = ({ status, ...props }) => ( <AutoComplete {...props} status={status}> {cloneElement(...)} </AutoComplete> );
现在明显是文档和实际使用对不上呀,不解决吗?靠使用时自己重新封装来规避吗? @zombieJ 这样直接就关了?
from ant-design.
我找了好几个人试能打开没问题,
from ant-design.
@afc163 您好,这个官方会解决吗
from ant-design.
我看 @zombieJ 已经给出解决方案了,而且确实有道理:#48871 (comment) 。
自定义组件也不一定都会换成 antd 的,也可以换成原生 input 组件,你无法期待原生 input 也有 status 属性。
如果使用自定义组件换掉内建组件了,一些相关属性确实可能会失效,需要自己补上。不只是 status,variant 也会丢失。
from ant-design.
我看 @zombieJ 已经给出解决方案了,而且确实有道理:#48871 (comment) 。
自定义组件也不一定都会换成 antd 的,也可以换成原生 input 组件,你无法期待原生 input 也有 status 属性。
如果使用自定义组件换掉内建组件了,一些相关属性确实可能会失效,需要自己补上。不只是 status,variant 也会丢失。
首先,感谢上面老师给的解决方案
然后我的问题是: @afc163
目前官方文档的描述来看,代码存在问题,并不符合预期。
为什么只是仅仅在这里给我一个解决方案,然后就关闭了issue,
难道不应该去修复这个问题,或者确定不提供这个使用方式,需要自己重新封装就改官方说明文档呀。
from ant-design.
Related Issues (20)
- Table 编辑行 ellipsis 失效 HOT 4
- 【bug】表格排序错误的排序出参 HOT 2
- Select组件通过 dropdownRender 自定义虚拟列表 Table, 提示React does not recognize the offsetX prop on a DOM element HOT 5
- 无法使用antd包 HOT 4
- [Wrong statement]Why is component defaultValue not working when inside Form.Item? HOT 4
- Badge 徽标数 设置了color时 count为0时 本该消失,但仍显示小红点 HOT 4
- Colorpicker dragging too many times will be banned HOT 8
- Modal组件的destroyOnClose属性无法销毁其中Form组件具有form属性时的状态 HOT 1
- 受控的Select组件,onChange中setValue为undefiend后,展示的label与实际的值不一致 HOT 3
- Dropdown 菜单支持展示 Checkbox HOT 5
- 父层级设置了scale后,Select下拉列表展开错误 HOT 1
- Table: Horizontal scrollbar is between table and fixed summary HOT 1
- DatePicker crashes when input is custimized via components props HOT 4
- datepicker 能否支持修改表头星期样式 HOT 4
- > Picker will set `locale` to dayjs object before format to ensure it get correct format with locale. Which means it's not enough to set timezone only and should provide fully local info. Pls ref official doc of ConfigProvider with correct locale handle. HOT 2
- 当Badge的status为processing且使用tailwindcss时,闪烁效果异常 HOT 2
- Tabs 以及页签禁用tabs键选中
- 升级V5后,原来的Less文件中使用的变量,在新版中怎么用
- After upgrading from version 5.5 to version 5.16 I get Node memory limit error HOT 6
- Table组件在dataSource为空数组时,且columns为动态列较多时,scroll设置为出现滚动条时,初次渲染会闪动,而且非常明显,感觉开始没有加载宽度,列越多闪动截止明显。 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ant-design.