因此,首先,我这样声明我的组件:
import styled from 'styled-components';
import {
space, color, layout, flexbox, border,
} from 'styled-system';
const FlexWrapper = styled.div`
display: flex;
gap: ${({ gap }) => gap || '10px'};
${layout};
${space};
${color};
${flexbox};
${border};
`;
export default FlexWrapper;
然后我就用它:
return (
<FlexWrapper flexDirection='column' width={width}>
<FlexWrapper flexDirection='row' gap='30px'>
{filters}
</FlexWrapper>
</FlexWrapper>
);
最终,道具可以正常工作,但vscode intellisense根本看不到。有什么解决方案可以解决它吗?
我在代码编辑器和IDE方面遇到了这个问题,我没有理会它们如果你没有使用Typescript,我强烈建议你使用Typescript来提高你的开发速度。
npx create-react-app --template typescript // :)
如果有用,请投票支持