mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-26 03:16:35 +08:00
fix(Stepper): should not submit form (#5183)
This commit is contained in:
parent
a04cb6237b
commit
4ab6ad4f0c
@ -107,15 +107,15 @@ export default {
|
|||||||
| name | Stepper name | *string \| number* | - | 2.0.3 |
|
| name | Stepper name | *string \| number* | - | 2.0.3 |
|
||||||
| integer | Whether to allow only integers | *boolean* | `false` | - |
|
| integer | Whether to allow only integers | *boolean* | `false` | - |
|
||||||
| disabled | Disable value change | *boolean* | `false` | - |
|
| disabled | Disable value change | *boolean* | `false` | - |
|
||||||
| disable-input | Disable input | *boolean* | `false` | - |
|
| disable-plus | Whether to disable plus button | *boolean* | `false` | 2.2.16 |
|
||||||
|
| disable-minus | Whether to disable minus button | *boolean* | `false` | 2.2.16 |
|
||||||
|
| disable-input | Whether to disable input | *boolean* | `false` | - |
|
||||||
| async-change | Whether to enable async change | *boolean* | `false` | - | - |
|
| async-change | Whether to enable async change | *boolean* | `false` | - | - |
|
||||||
| input-width | Input width | *string \| number* | `32px` | - |
|
| input-width | Input width | *string \| number* | `32px` | - |
|
||||||
| button-size | Button size | *string \| number* | `28px` | 2.0.5 |
|
| button-size | Button size | *string \| number* | `28px` | 2.0.5 |
|
||||||
| show-plus | Whether to show plus button | *boolean* | `true` | 2.1.2 |
|
| show-plus | Whether to show plus button | *boolean* | `true` | 2.1.2 |
|
||||||
| show-minus | Whether to show minus button | *boolean* | `true` | 2.1.2 |
|
| show-minus | Whether to show minus button | *boolean* | `true` | 2.1.2 |
|
||||||
| decimal-length | Decimal length | *number* | - | 2.2.1 |
|
| decimal-length | Decimal length | *number* | - | 2.2.1 |
|
||||||
| disable-plus | Whether to disable plus button | *boolean* | - | 2.3.0 |
|
|
||||||
| disable-minus | Whether to disable minus button | *boolean* | - | 2.3.0 |
|
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
|
|
||||||
|
@ -129,6 +129,8 @@ export default {
|
|||||||
| name | 标识符,可以在`change`事件回调参数中获取 | *string \| number* | - | 2.2.11 |
|
| name | 标识符,可以在`change`事件回调参数中获取 | *string \| number* | - | 2.2.11 |
|
||||||
| integer | 是否只允许输入整数 | *boolean* | `false` | - |
|
| integer | 是否只允许输入整数 | *boolean* | `false` | - |
|
||||||
| disabled | 是否禁用步进器 | *boolean* | `false` | - |
|
| disabled | 是否禁用步进器 | *boolean* | `false` | - |
|
||||||
|
| disable-plus | 是否禁用增加按钮 | *boolean* | `false` | 2.2.16 |
|
||||||
|
| disable-minus | 是否禁用减少按钮 | *boolean* | `false` | 2.2.16 |
|
||||||
| disable-input | 是否禁用输入框 | *boolean* | `false` | - |
|
| disable-input | 是否禁用输入框 | *boolean* | `false` | - |
|
||||||
| async-change | 是否开启异步变更,开启后需要手动控制输入值 | *boolean* | `false` | - |
|
| async-change | 是否开启异步变更,开启后需要手动控制输入值 | *boolean* | `false` | - |
|
||||||
| input-width | 输入框宽度,默认单位为`px` | *string \| number* | `32px` | - |
|
| input-width | 输入框宽度,默认单位为`px` | *string \| number* | `32px` | - |
|
||||||
@ -136,8 +138,6 @@ export default {
|
|||||||
| show-plus | 是否显示增加按钮 | *boolean* | `true` | 2.1.2 |
|
| show-plus | 是否显示增加按钮 | *boolean* | `true` | 2.1.2 |
|
||||||
| show-minus | 是否显示减少按钮 | *boolean* | `true` | 2.1.2 |
|
| show-minus | 是否显示减少按钮 | *boolean* | `true` | 2.1.2 |
|
||||||
| decimal-length | 固定显示的小数位数 | *number* | - | 2.2.1 |
|
| decimal-length | 固定显示的小数位数 | *number* | - | 2.2.1 |
|
||||||
| disable-plus | 是否禁用增加按钮 | *boolean* | - | 2.3.0 |
|
|
||||||
| disable-minus | 是否禁用减少按钮 | *boolean* | - | 2.3.0 |
|
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
|
|
||||||
|
@ -25,6 +25,8 @@ export default createComponent({
|
|||||||
inputWidth: [Number, String],
|
inputWidth: [Number, String],
|
||||||
buttonSize: [Number, String],
|
buttonSize: [Number, String],
|
||||||
asyncChange: Boolean,
|
asyncChange: Boolean,
|
||||||
|
disablePlus: Boolean,
|
||||||
|
disableMinus: Boolean,
|
||||||
disableInput: Boolean,
|
disableInput: Boolean,
|
||||||
decimalLength: Number,
|
decimalLength: Number,
|
||||||
name: {
|
name: {
|
||||||
@ -54,12 +56,6 @@ export default createComponent({
|
|||||||
showMinus: {
|
showMinus: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
},
|
|
||||||
disablePlus: {
|
|
||||||
type: Boolean
|
|
||||||
},
|
|
||||||
disableMinus: {
|
|
||||||
type: Boolean
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -259,6 +255,7 @@ export default createComponent({
|
|||||||
<div class={bem()}>
|
<div class={bem()}>
|
||||||
<button
|
<button
|
||||||
vShow={this.showMinus}
|
vShow={this.showMinus}
|
||||||
|
type="button"
|
||||||
style={this.buttonStyle}
|
style={this.buttonStyle}
|
||||||
class={bem('minus', { disabled: this.minusDisabled })}
|
class={bem('minus', { disabled: this.minusDisabled })}
|
||||||
{...createListeners('minus')}
|
{...createListeners('minus')}
|
||||||
@ -279,6 +276,7 @@ export default createComponent({
|
|||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
vShow={this.showPlus}
|
vShow={this.showPlus}
|
||||||
|
type="button"
|
||||||
style={this.buttonStyle}
|
style={this.buttonStyle}
|
||||||
class={bem('plus', { disabled: this.plusDisabled })}
|
class={bem('plus', { disabled: this.plusDisabled })}
|
||||||
{...createListeners('plus')}
|
{...createListeners('plus')}
|
||||||
|
@ -5,49 +5,49 @@ exports[`renders demo correctly 1`] = `
|
|||||||
<div class="van-cell van-cell--center">
|
<div class="van-cell van-cell--center">
|
||||||
<div class="van-cell__title"><span>基础用法</span></div>
|
<div class="van-cell__title"><span>基础用法</span></div>
|
||||||
<div class="van-cell__value">
|
<div class="van-cell__value">
|
||||||
<div class="van-stepper"><button class="van-stepper__minus van-stepper__minus--disabled"></button><input type="number" role="spinbutton" aria-valuemax="Infinity" aria-valuemin="1" aria-valuenow="1" class="van-stepper__input"><button class="van-stepper__plus"></button></div>
|
<div class="van-stepper"><button type="button" class="van-stepper__minus van-stepper__minus--disabled"></button><input type="number" role="spinbutton" aria-valuemax="Infinity" aria-valuemin="1" aria-valuenow="1" class="van-stepper__input"><button type="button" class="van-stepper__plus"></button></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-cell van-cell--center">
|
<div class="van-cell van-cell--center">
|
||||||
<div class="van-cell__title"><span>步长设置</span></div>
|
<div class="van-cell__title"><span>步长设置</span></div>
|
||||||
<div class="van-cell__value">
|
<div class="van-cell__value">
|
||||||
<div class="van-stepper"><button class="van-stepper__minus van-stepper__minus--disabled"></button><input type="number" role="spinbutton" aria-valuemax="Infinity" aria-valuemin="1" aria-valuenow="1" class="van-stepper__input"><button class="van-stepper__plus"></button></div>
|
<div class="van-stepper"><button type="button" class="van-stepper__minus van-stepper__minus--disabled"></button><input type="number" role="spinbutton" aria-valuemax="Infinity" aria-valuemin="1" aria-valuenow="1" class="van-stepper__input"><button type="button" class="van-stepper__plus"></button></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-cell van-cell--center">
|
<div class="van-cell van-cell--center">
|
||||||
<div class="van-cell__title"><span>限制输入范围</span></div>
|
<div class="van-cell__title"><span>限制输入范围</span></div>
|
||||||
<div class="van-cell__value">
|
<div class="van-cell__value">
|
||||||
<div class="van-stepper"><button class="van-stepper__minus van-stepper__minus--disabled"></button><input type="number" role="spinbutton" aria-valuemax="8" aria-valuemin="5" aria-valuenow="5" class="van-stepper__input"><button class="van-stepper__plus"></button></div>
|
<div class="van-stepper"><button type="button" class="van-stepper__minus van-stepper__minus--disabled"></button><input type="number" role="spinbutton" aria-valuemax="8" aria-valuemin="5" aria-valuenow="5" class="van-stepper__input"><button type="button" class="van-stepper__plus"></button></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-cell van-cell--center">
|
<div class="van-cell van-cell--center">
|
||||||
<div class="van-cell__title"><span>限制输入整数</span></div>
|
<div class="van-cell__title"><span>限制输入整数</span></div>
|
||||||
<div class="van-cell__value">
|
<div class="van-cell__value">
|
||||||
<div class="van-stepper"><button class="van-stepper__minus van-stepper__minus--disabled"></button><input type="number" role="spinbutton" aria-valuemax="Infinity" aria-valuemin="1" aria-valuenow="1" class="van-stepper__input"><button class="van-stepper__plus"></button></div>
|
<div class="van-stepper"><button type="button" class="van-stepper__minus van-stepper__minus--disabled"></button><input type="number" role="spinbutton" aria-valuemax="Infinity" aria-valuemin="1" aria-valuenow="1" class="van-stepper__input"><button type="button" class="van-stepper__plus"></button></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-cell van-cell--center">
|
<div class="van-cell van-cell--center">
|
||||||
<div class="van-cell__title"><span>禁用状态</span></div>
|
<div class="van-cell__title"><span>禁用状态</span></div>
|
||||||
<div class="van-cell__value">
|
<div class="van-cell__value">
|
||||||
<div class="van-stepper"><button class="van-stepper__minus van-stepper__minus--disabled"></button><input type="number" role="spinbutton" aria-valuemax="Infinity" aria-valuemin="1" aria-valuenow="1" disabled="disabled" class="van-stepper__input"><button class="van-stepper__plus van-stepper__plus--disabled"></button></div>
|
<div class="van-stepper"><button type="button" class="van-stepper__minus van-stepper__minus--disabled"></button><input type="number" role="spinbutton" aria-valuemax="Infinity" aria-valuemin="1" aria-valuenow="1" disabled="disabled" class="van-stepper__input"><button type="button" class="van-stepper__plus van-stepper__plus--disabled"></button></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-cell van-cell--center">
|
<div class="van-cell van-cell--center">
|
||||||
<div class="van-cell__title"><span>固定小数位数</span></div>
|
<div class="van-cell__title"><span>固定小数位数</span></div>
|
||||||
<div class="van-cell__value">
|
<div class="van-cell__value">
|
||||||
<div class="van-stepper"><button class="van-stepper__minus van-stepper__minus--disabled"></button><input type="number" role="spinbutton" aria-valuemax="Infinity" aria-valuemin="1" aria-valuenow="1.0" class="van-stepper__input"><button class="van-stepper__plus"></button></div>
|
<div class="van-stepper"><button type="button" class="van-stepper__minus van-stepper__minus--disabled"></button><input type="number" role="spinbutton" aria-valuemax="Infinity" aria-valuemin="1" aria-valuenow="1.0" class="van-stepper__input"><button type="button" class="van-stepper__plus"></button></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-cell van-cell--center">
|
<div class="van-cell van-cell--center">
|
||||||
<div class="van-cell__title"><span>自定义大小</span></div>
|
<div class="van-cell__title"><span>自定义大小</span></div>
|
||||||
<div class="van-cell__value">
|
<div class="van-cell__value">
|
||||||
<div class="van-stepper"><button class="van-stepper__minus van-stepper__minus--disabled" style="width: 32px; height: 32px;"></button><input type="number" role="spinbutton" aria-valuemax="Infinity" aria-valuemin="1" aria-valuenow="1" class="van-stepper__input" style="width: 40px; height: 32px;"><button class="van-stepper__plus" style="width: 32px; height: 32px;"></button></div>
|
<div class="van-stepper"><button type="button" class="van-stepper__minus van-stepper__minus--disabled" style="width: 32px; height: 32px;"></button><input type="number" role="spinbutton" aria-valuemax="Infinity" aria-valuemin="1" aria-valuenow="1" class="van-stepper__input" style="width: 40px; height: 32px;"><button type="button" class="van-stepper__plus" style="width: 32px; height: 32px;"></button></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-cell van-cell--center">
|
<div class="van-cell van-cell--center">
|
||||||
<div class="van-cell__title"><span>异步变更</span></div>
|
<div class="van-cell__title"><span>异步变更</span></div>
|
||||||
<div class="van-cell__value">
|
<div class="van-cell__value">
|
||||||
<div class="van-stepper"><button class="van-stepper__minus van-stepper__minus--disabled"></button><input type="number" role="spinbutton" aria-valuemax="Infinity" aria-valuemin="1" aria-valuenow="1" class="van-stepper__input"><button class="van-stepper__plus"></button></div>
|
<div class="van-stepper"><button type="button" class="van-stepper__minus van-stepper__minus--disabled"></button><input type="number" role="spinbutton" aria-valuemax="Infinity" aria-valuemin="1" aria-valuenow="1" class="van-stepper__input"><button type="button" class="van-stepper__plus"></button></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`disable stepper input 1`] = `<div class="van-stepper"><button class="van-stepper__minus van-stepper__minus--disabled"></button><input type="number" role="spinbutton" aria-valuemax="Infinity" aria-valuemin="1" aria-valuenow="1" disabled="disabled" class="van-stepper__input"><button class="van-stepper__plus"></button></div>`;
|
exports[`disable stepper input 1`] = `<div class="van-stepper"><button type="button" class="van-stepper__minus van-stepper__minus--disabled"></button><input type="number" role="spinbutton" aria-valuemax="Infinity" aria-valuemin="1" aria-valuenow="1" disabled="disabled" class="van-stepper__input"><button type="button" class="van-stepper__plus"></button></div>`;
|
||||||
|
|
||||||
exports[`disabled stepper 1`] = `<div class="van-stepper"><button class="van-stepper__minus van-stepper__minus--disabled"></button><input type="number" role="spinbutton" aria-valuemax="Infinity" aria-valuemin="1" aria-valuenow="1" disabled="disabled" class="van-stepper__input"><button class="van-stepper__plus van-stepper__plus--disabled"></button></div>`;
|
exports[`disabled stepper 1`] = `<div class="van-stepper"><button type="button" class="van-stepper__minus van-stepper__minus--disabled"></button><input type="number" role="spinbutton" aria-valuemax="Infinity" aria-valuemin="1" aria-valuenow="1" disabled="disabled" class="van-stepper__input"><button type="button" class="van-stepper__plus van-stepper__plus--disabled"></button></div>`;
|
||||||
|
|
||||||
exports[`input-width prop 1`] = `<div class="van-stepper"><button class="van-stepper__minus van-stepper__minus--disabled"></button><input type="number" role="spinbutton" aria-valuemax="Infinity" aria-valuemin="1" aria-valuenow="1" class="van-stepper__input" style="width: 10rem;"><button class="van-stepper__plus"></button></div>`;
|
exports[`input-width prop 1`] = `<div class="van-stepper"><button type="button" class="van-stepper__minus van-stepper__minus--disabled"></button><input type="number" role="spinbutton" aria-valuemax="Infinity" aria-valuemin="1" aria-valuenow="1" class="van-stepper__input" style="width: 10rem;"><button type="button" class="van-stepper__plus"></button></div>`;
|
||||||
|
|
||||||
exports[`show-plus & show-minus props 1`] = `<div class="van-stepper"><button class="van-stepper__minus van-stepper__minus--disabled" style="display: none;"></button><input type="number" role="spinbutton" aria-valuemax="Infinity" aria-valuemin="1" aria-valuenow="1" class="van-stepper__input"><button class="van-stepper__plus" style="display: none;"></button></div>`;
|
exports[`show-plus & show-minus props 1`] = `<div class="van-stepper"><button type="button" class="van-stepper__minus van-stepper__minus--disabled" style="display: none;"></button><input type="number" role="spinbutton" aria-valuemax="Infinity" aria-valuemin="1" aria-valuenow="1" class="van-stepper__input"><button type="button" class="van-stepper__plus" style="display: none;"></button></div>`;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user