简体   繁体   English

Material-Ui文本字段提示文本不起作用

[英]Material-Ui textfield Hinttext not working

I want to design textfield according to job requirement. 我想根据工作要求设计文本框。 I am assigning background to TextField. 我将背景分配给TextField。 Now when background color is assigned then its hintText is gone. 现在,分配背景色后,其提示文本就消失了。 Then i have to set z-index of that label manually. 然后,我必须手动设置该标签的z-index。

Now hintText is showing but when i click on that text then Textfield is not working and when i click outside of text then it is working. 现在,提示文本正在显示,但是当我单击该文本时,Textfield不起作用;当我单击文本之外时,则它正在起作用。

This is my textfield style: 这是我的文本框样式:

        <TextField
        hintText="Rate"
        className="rateText"
        inputStyle={{background:"#fff",paddingLeft: "3px"}}
    style={{paddingBottom:"10px"}}
hintStyle={{color: "rgba(0,0,0,.26)",zIndex: "1",bottom: "20px",left: "5px"}} 

/> />

Try setting the backgroundColor on the style, rather than the inputStyle. 尝试在样式上而不是inputStyle上设置backgroundColor。 The textbox itself will remain transparent and its placeholder text will continue to work, but the white background of the container div will show through: 文本框本身将保持透明,并且其占位符文本将继续起作用,但是容器div的白色背景将通过以下方式显示:

    <TextField
      hintText="Rate"
      style={{ backgroundColor: '#fff' }}
    />

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM