【问题标题】:Keep getting warning: Invalid DOM property `autocomplete`. Did you mean `autoComplete`?不断收到警告:无效的 DOM 属性“自动完成”。你的意思是“自动完成”吗?
【发布时间】:2019-04-20 14:44:36
【问题描述】:

当我在 Google Chrome。 当我尝试在 Firefox 上编译代码时,一切正常。

我想问一个问题:如何在谷歌浏览器上修复这个错误?为什么只在 Google Chrome 上显示此错误?

这是我的代码:

import React from "react";

import {
Container, Col, Form,
FormGroup, Label, Input,
Button,
} from 'reactstrap';

export default class Register extends React.Component{

render() {

    return (
        <div>

            <Container>
                <h2>Sign In</h2>
                <Form>
                    <Col>
                        <FormGroup>
                            <Label>Email</Label>
                            <Input
                                type="email"
                                name="email"
                                id="exampleEmail"
                                placeholder="myemail@email.com"

                              autocomplete = "email"
                            />
                        </FormGroup>
                    </Col>
                    <Col>
                        <FormGroup>
                            <Label for="PhoneNumber">Phone Number</Label>
                            <Input
                                type="Phone Number"
                                name="Phone Number"
                                id="exampleNumber"
                                placeholder="37060289225"
                            />
                        </FormGroup>
                    </Col>
                    <Col>
                        <FormGroup>
                            <Label for="RepeatPassword">Repeat Password</Label>
                            <Input
                                type="password"
                                name="Repeat Password"
                                id="RepeatPassword"
                                placeholder="********"

                               autocomplete="new-password"
                            />
                        </FormGroup>
                    </Col>
                    <Col>
                        <FormGroup>
                            <Label for="examplePassword">Password</Label>
                            <Input
                                type="password"
                                name="password"
                                id="examplePassword"
                                placeholder="********"

                               autocomplete = "new-password"
                            />
                        </FormGroup>
                    </Col>

                    <Button>Submit</Button>
                </Form>
            </Container>
        </div>
    );
}
}

【问题讨论】:

  • JSX 与 HTML 并不完全相同。 autoComplete 是正确的。

标签: reactjs google-chrome


【解决方案1】:

在输入中使用道具自动完成时,它希望您将其替换为 autoComplete="new-password"

【讨论】:

    【解决方案2】:

    这是一个,链接:GitHub Problem

    我会将此标记为重复 因为有: [备忘单][2] [2]:https://medium.com/react-tutorials/react-properties-ef11cd55caa0 也是。

    我会,说这些链接,会帮助你。

    希望这个,会有所帮助!

    【讨论】:

      猜你喜欢
      • 2020-04-16
      • 2020-09-01
      • 2020-12-17
      • 2017-04-07
      • 1970-01-01
      • 2015-08-20
      • 1970-01-01
      • 2021-04-27
      • 2014-03-04
      相关资源
      最近更新 更多