breaking change(Button): adjust default native-type to button

This commit is contained in:
chenjiahan
2020-09-13 14:40:31 +08:00
parent 588e15f9b5
commit df8059eb01
5 changed files with 7 additions and 17 deletions
-14
View File
@@ -509,17 +509,3 @@ export default {
| 名称 | 说明 |
| ------- | -------- |
| default | 表单内容 |
## 常见问题
### 点击表单中的普通按钮为什么会触发表单提交?
在表单中,除了提交按钮外,可能还有一些其他的功能性按钮,如发送验证码按钮。在使用这些按钮时,要注意将`native-type`设置为`button`,否则会触发表单提交。
```html
<van-button native-type="button">
发送验证码
</van-button>
```
这个问题的原因是浏览器中 button 标签 type 属性的默认值为`submit`,导致触发表单提交。我们会在下个大版本中将 type 的默认值调整为`button`来避免这个问题。