当我将表单登录添加到100文件中时,我的控制台中有一个错误,但我不知道问题到底在哪里:

这是我的模式:

<section className="vh-100">
        <div className="container-fluid h-custom">
          <div className="row d-flex justify-content-center align-items-center h-100">
            <div className="col-md-9 col-lg-6 col-xl-5">
              <img
                src="https://mdbcdn.b-cdn.net/img/Photos/new-templates/bootstrap-login-form/draw2.webp"
                className="img-fluid"
                alt="Sample image"
              />
            </div>
            <div className="col-md-8 col-lg-6 col-xl-4 offset-xl-1">
              <form onSubmit={handleSubmit}>
                <div className="divider d-flex align-items-center my-4">
                  <p className="text-center fw-bold mx-3 mb-0">
                    Connexion à l'application
                  </p>
                </div>

                <div className="form-group form-outline mb-4">
                  <input
                    type="email"
                    name="username"
                    id="username"
                    className={
                      "form-control form-control-lg" + (error && " is-invalid")
                    }
                    placeholder="Adresse email de connexion"
                    value={credentials.username}
                    onChange={handleChange}
                  />
                  <label className="form-label" htmlFor="username">
                    Adresse email
                  </label>
                  {error && <p className="invalid-feedback">{error}</p>}
                </div>

                <div className="form-outline mb-3">
                  <input
                    type="password"
                    name="password"
                    id="password"
                    className={
                      "form-control form-control-lg" + (error && " is-invalid")
                    }
                    placeholder="Mot de passe"
                    value={credentials.password}
                    onChange={handleChange}
                  />
                  <label className="form-label" htmlFor="password">
                    Mot de passe
                  </label>
                </div>

                <div className="d-flex justify-content-between align-items-center">
                  <div className="form-check mb-0">
                    <input
                      className="form-check-input me-2"
                      type="checkbox"
                      value=""
                      id="remeberMe"
                    />
                    <label className="form-check-label" htmlFor="remeberMe">
                      Souviens moi
                    </label>
                  </div>
                  <a href="#!" className="text-body">
                    Mot de passe oublié?
                  </a>
                </div>

                <div className="form-group text-center text-lg-start mt-4 pt-2">
                  <button
                    type="submit"
                    className="btn btn-primary btn-lg"
                    style="padding-left: 2.5rem; padding-right: 2.5rem;"
                  >
                    Je me connecte
                  </button>
                  <p className="small fw-bold mt-2 pt-1 mb-0">
                    Vous n'avez pas de compte ?{" "}
                    <a href="#" className="link-danger">
                      Inscription
                    </a>
                  </p>
                </div>
              </form>
            </div>
          </div>
        </div>
      </section>

以下是我的控制台中的所有错误:

The above error occurred in the component: at button at div at form at div at div at div at section at LoginPage (http://localhost:8080/build/app.js:933:67) at Routes (http://localhost:8080/build/vendors-node_modules_axios_index_js-node_modules_core-js_modules_es_array_filter_js-node_modu-876774.js:63113:5) at main at Router (http://localhost:8080/build/vendors-node_modules_axios_index_js-node_modules_core-js_modules_es_array_filter_js-node_modu-876774.js:63047:15) at HashRouter (http://localhost:8080/build/vendors-node_modules_axios_index_js-node_modules_core-js_modules_es_array_filter_js-node_modu-876774.js:61920:5) at App

Uncaught Error: The 100 prop expects a mapping from style properties to values, not a string.

谢谢

推荐答案

我认为问题出在提交按钮的样式标签中

更改这一点:

style="padding-left: 2.5rem; padding-right: 2.5rem;"

对此:

style={{ paddingLeft: "2.5rem", paddingRight: "2.5" }}

希望它能有所帮助;)

Javascript相关问答推荐

通过使用100%间隔时间来代表我们还剩多少时间来倒计时

Cypress -使用commands.js将数据测试id串在一起失败,但在将它们串在一起时不使用命令有效

使用下表中所示的值初始化一个二维数组

我可以从React中的出口从主布局调用一个处理程序函数吗?

使用LocaleCompare()进行排序时,首先使用大写字母

使用Google API无法进行Web抓取

WP Bootstrap NavWaker:下拉菜单一次打开所有下拉菜单

Use Location位置成员在HashRouter内为空

SPAN不会在点击时关闭模式,尽管它们可以发送日志(log)等

如何防止ionic 输入中的特殊字符.?

删除元素属性或样式属性的首选方法

将多个文本框中的输出合并到一个文本框中

rxjs在每次迭代后更新数组的可观察值

在Press Reaction本机和EXPO av上播放单个文件

如何向内部有文本输入字段的HTML表添加行?

Firefox的绝对定位没有达到预期效果

无法在Adyen自定义卡安全字段创建中使用自定义占位符

如何动态呈现适合未知屏幕大小的最大数量的表行?苗条的

使用JAVASCRIPT-使用If和Else If多次判断条件-使用JAVASRIPT对象及其属性

查找函数句柄的模块/文件