简体   繁体   English

输入的占位符值未显示在部署到 Vercel 的 React 项目中,包括.netlify

[英]placeholder values on input not showing on a React Project deployed to Vercel including netlify

Am using the React hook-forms library for my forms values and validations of input datas.我正在为我的 forms 值和输入数据验证使用 React hook-forms 库。 The Placeholder is showing on development server, which is the localhost but on deploying, the placholder wont show, making it seems like there is no how to understand what should be typed into the fields.占位符显示在开发服务器上,这是本地主机,但在部署时,占位符不会显示,看起来似乎无法理解应该在字段中输入什么。

import { useForm } from "react-hook-form";


function Contact(){
   const {
    register,
    handleSubmit,
    formState: { errors },
    trigger,
    reset,
    setFocus,
  } = useForm();

  useEffect(() => {
    setFocus("name");
  }, []);

return (
       <form className="forminformation" onSubmit={handleSubmit(onSubmit)}>
              <aside
                data-aos="fade-left"
                data-aos-delay="500"
                className="form-inputs"
              >
                <input
                  placeholder="Full Name"
                  type="text"
                  autoComplete="new-name"
                  {...register("name", { required: "can't be empty" })}
                  onKeyUp={() => trigger("name")}
                />
                {errors.name && (
                  <p className="error-Info ">
                    <em>{errors.name.message}</em>
                    <img src={ErrorIcon} alt="ErrorIcon" />
                  </p>
                )}
              </aside
</form>
)
}

The Placeholder is working on localhost but neither vercel or.netify is showing it占位符正在本地主机上工作,但 vercel 或 .netify 都没有显示它

localhost image below enter image description here下面的本地主机图片在这里输入图片描述

vercel enter image description here vercel在此处输入图像描述

I Later got what was wrong with the code and while placeholder value is not showing on production.我后来发现代码出了什么问题,而占位符值没有在生产中显示。 I was following a figma file to design the website.我正在按照一个 figma 文件来设计网站。 so i had this in my code which is what figma usually use for their file and what has been causing issues所以我在我的代码中有这个,这是 figma 通常用于他们的文件的东西,也是导致问题的原因

opacity:50%;

so instead of using the above, i changed my css file into所以我没有使用上面的方法,而是将 css 文件更改为

opacity:.5;

and this works for me.这对我有用。

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

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