-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
类型定义冲突 #7
Comments
看来得换名字咯 |
theme 不冲突, as 可以用 forwardedAs 代替 |
theme 还是换个名字吧,表现形式还不一样 |
自定义滚动条宽度和固定的滚动容器高度[例如select里防止继续resize高度]可以考虑下 |
固定的容器高度[select里防止继续resize高度] 场景体现在哪里,select 高度会一直 resize 吗 |
我的错,我猜的会不会有这个问题,因为没有细滚动条还没写过select |
@MinJieLiu forwardedAs没搞明白如何使用,我这样使用会触发TS类型错误 <Scrollbar forwardedAs='ul'>
<div style={{ height: 2000 }}>{children}</div>
</Scrollbar> const Wrapper = styled(MacScrollbar)<ScrollbarProps>`
height: inherit;
`;
const Scrollbar: React.FC<ScrollbarProps> = (props: ScrollbarProps) => {
const { forwardedAs,children, ...rest } = props;
return (
<Wrapper forwardedAs={'li'} {...rest}>
{children}
</Wrapper>
);
}; |
感谢🙏我明白了,请问可以看一下forwardedAs为什么类型错误吗? |
有仓库吗 |
https://github.com/usercao/ice-test 就是这个仓库里面的components->scrollbar组件 |
const Scrollbar: React.FC<ScrollbarProps> = (props: ScrollbarProps) => {
const { as, children, ...rest } = props;
return (
<Wrapper forwardedAs={as as keyof JSX.IntrinsicElements} {...rest}>
{children}
</Wrapper>
);
}; |
@MinJieLiu 非常感谢🙏我TS写的有点少不好意思😂 |
类型定义名称
theme
as
与styled-components
起冲突,最小实例地址:https://github.com/usercao/ice-testThe text was updated successfully, but these errors were encountered: