简中文档

button-has-type

检查 <button> JSX 元素是否具有有效的 type 属性。默认值是 "submit",这通常不是所期望的行为。

无效:

<button />
<button type="foo" />
<button type={condition ? "foo" : "bar"} />
<button type={foo} />
<button type={2} />

有效:

<button type="submit" />
<button type="button" />
<button type="reset" />
<button type={condition ? "button" : "submit"} />

你找到了你需要的东西吗?

编辑此页面
隐私政策