简体   繁体   English

使用反应电话号码输入时如何为电话输入的边框颜色设置无

[英]How to set none for border color of the phone input when using react-phone-number-input

I'm using react-phone-number-input.我正在使用反应电话号码输入。 This is the phone number field:这是电话号码字段:

<PhoneInput
    defaultCountry={"CA"}
    placeholder={"Phone"}
    value={phone}
    onChange={(value: string) => {
       setPhone(value);
    }}
/>

and the css style from: https://gitlab.com/catamphetamine/react-phone-number-input/-/blob/master/style.css和 css 样式来自: https://gitlab.com/catamphetamine/react-phone-number-input/-/blob/master/style.css

I set the border and outline of PhoneInputInput to none but it not working when focus.我将 PhoneInputInput 的边框和轮廓设置为无,但在焦点时它不起作用。

.PhoneInputInput:focus-visible {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
}

Here's the image of this field:这是该字段的图像: 电话输入字段

It seems to be caused by the default input of reactjs. I added this to the globals.css file:好像是默认输入reactjs导致的,我在globals.css文件中添加了这个:

.input-phone-number input:focus{
    outline: none !important;
    border:none !important;
    box-shadow: none !important;
}

and use it in the PhoneInput field, then it worked for me:并在 PhoneInput 字段中使用它,然后它对我有用:

<PhoneInput
    defaultCountry={"CA"}
    placeholder={"Phone"}
    value={phone}
    onChange={(value: string) => {
       setPhone(value);
    }}
    className={"input-phone-number"}
/>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 react-phone-number-input 插入数据?,插入电话号码时出现验证错误 - How can I insert a data using react-phone-number-input?, validation error when I'm inserting a phone number 如何使用Yarn安装react-phone-number-input? - How to install react-phone-number-input with Yarn? 如何使用 react-phone-number-input 库与 Formik 成为朋友? - How to friend Formik with react-phone-number-input lib? "没有国家选择器的 react-phone-number-input" - react-phone-number-input without the country selector 当您尝试在 PhoneInput(React 和 React-phone-number-input)键入内容时,弹出窗口会自行关闭 - Popup closes byself when you try to type something at PhoneInput (React and React-phone-number-input) React-Phone-Number-Input + React-Hook-Form:如何在控制器验证中获取当前国家代码? - React-Phone-Number-Input + React-Hook-Form: How to get current country code in controller validation? 如何将 react-phone-number-input 添加到-react-final-form? - How to add react-phone-number-input to -react-final-form? 如何将 react-phone-number-input 与 Formik 的 Field 组件一起使用 - How to use react-phone-number-input with Formik's Field component 如何限制 npm react-phone-number-input 包中的国家/地区列表 - How to limited the countries list in npm react-phone-number-input package 如何在 react-phone-number-input 中使用 material-ui TextField - How to use material-ui TextField with react-phone-number-input
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM