使用样式组件隐藏输入微调器

Zer*_*rty 3 css styled-components

有很多解决方案可以使用 css 隐藏输入微调器。其中之一是:

input::-webkit-inner-spin-button, input::-webkit-outer-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
    -moz-appearance:textfield !important;
}
Run Code Online (Sandbox Code Playgroud)

我想知道如何在样式组件中实现它?谢谢

Bru*_*iro 9

像这样声明:

const Input = styled.input`
    ::-webkit-inner-spin-button{
        -webkit-appearance: none; 
        margin: 0; 
    }
    ::-webkit-outer-spin-button{
        -webkit-appearance: none; 
        margin: 0; 
    }    
`;
Run Code Online (Sandbox Code Playgroud)

像这样使用:

<Input type="number">