mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(Stepper): add placeholder prop (#6519)
This commit is contained in:
parent
febf17e546
commit
6de66e0455
@ -216,7 +216,7 @@ Use `input-align` prop to align the input value
|
||||
| type | Input type, can be set to `tel` `digit`<br>`number` `textarea` `password` | _string_ | `text` |
|
||||
| size | Size,can be set to `large` | _string_ | - |
|
||||
| maxlength | Max length of value | _number \| string_ | - |
|
||||
| placeholder | Placeholder | _string_ | - |
|
||||
| placeholder | Input placeholder | _string_ | - |
|
||||
| border | Whether to show inner border | _boolean_ | `true` |
|
||||
| disabled | Whether to disable field | _boolean_ | `false` |
|
||||
| readonly | Whether to be readonly | _boolean_ | `false` |
|
||||
|
@ -241,7 +241,7 @@ export default {
|
||||
| type | 输入框类型, 可选值为 `tel` `digit`<br>`number` `textarea` `password` 等 | _string_ | `text` |
|
||||
| size | 大小,可选值为 `large` | _string_ | - |
|
||||
| maxlength | 输入的最大字符数 | _number \| string_ | - |
|
||||
| placeholder | 占位提示文字 | _string_ | - |
|
||||
| placeholder | 输入框占位提示文字 | _string_ | - |
|
||||
| border | 是否显示内边框 | _boolean_ | `true` |
|
||||
| disabled | 是否禁用输入框 | _boolean_ | `false` |
|
||||
| readonly | 是否只读 | _boolean_ | `false` |
|
||||
|
@ -119,8 +119,9 @@ export default {
|
||||
| button-size `v2.0.5` | Button size | _number \| string_ | `28px` |
|
||||
| decimal-length `v2.2.1` | Decimal length | _number \| string_ | - |
|
||||
| theme `v2.8.2` | Theme, can be set to `round` | _string_ | - |
|
||||
| placeholder `v2.8.6` | Input placeholder | _string_ | - |
|
||||
| integer | Whether to allow only integers | _boolean_ | `false` |
|
||||
| disabled | Disable value change | _boolean_ | `false` |
|
||||
| disabled | Whether to disable value change | _boolean_ | `false` |
|
||||
| disable-plus `v2.2.16` | Whether to disable plus button | _boolean_ | `false` |
|
||||
| disable-minus `v2.2.16` | Whether to disable minus button | _boolean_ | `false` |
|
||||
| disable-input | Whether to disable input | _boolean_ | `false` |
|
||||
|
@ -145,6 +145,7 @@ export default {
|
||||
| button-size `v2.0.5` | 按钮大小以及输入框高度,默认单位为`px` | _number \| string_ | `28px` |
|
||||
| decimal-length `v2.2.1` | 固定显示的小数位数 | _number \| string_ | - |
|
||||
| theme `v2.8.2` | 样式风格,可选值为 `round` | _string_ | - |
|
||||
| placeholder `v2.8.6` | 输入框占位提示文字 | _string_ | - |
|
||||
| integer | 是否只允许输入整数 | _boolean_ | `false` |
|
||||
| disabled | 是否禁用步进器 | _boolean_ | `false` |
|
||||
| disable-plus `v2.2.16` | 是否禁用增加按钮 | _boolean_ | `false` |
|
||||
|
@ -31,6 +31,7 @@ export default createComponent({
|
||||
inputWidth: [Number, String],
|
||||
buttonSize: [Number, String],
|
||||
asyncChange: Boolean,
|
||||
placeholder: String,
|
||||
disablePlus: Boolean,
|
||||
disableMinus: Boolean,
|
||||
disableInput: Boolean,
|
||||
@ -298,6 +299,7 @@ export default createComponent({
|
||||
readonly={this.disableInput}
|
||||
// set keyboard in mordern browers
|
||||
inputmode={this.integer ? 'numeric' : 'decimal'}
|
||||
placeholder={this.placeholder}
|
||||
aria-valuemax={this.max}
|
||||
aria-valuemin={this.min}
|
||||
aria-valuenow={this.currentValue}
|
||||
|
@ -8,4 +8,6 @@ exports[`disabled stepper 1`] = `<div class="van-stepper"><button type="button"
|
||||
|
||||
exports[`input-width prop 1`] = `<div class="van-stepper"><button type="button" class="van-stepper__minus van-stepper__minus--disabled"></button><input type="text" role="spinbutton" inputmode="decimal" 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[`placeholder prop 1`] = `<input type="text" role="spinbutton" inputmode="decimal" placeholder="foo" aria-valuemax="Infinity" aria-valuemin="1" aria-valuenow="1" class="van-stepper__input">`;
|
||||
|
||||
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="text" role="spinbutton" inputmode="decimal" 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>`;
|
||||
|
@ -378,3 +378,12 @@ test('change integer', async () => {
|
||||
|
||||
expect(wrapper.emitted('input')[0][0]).toEqual(1);
|
||||
});
|
||||
|
||||
test('placeholder prop', () => {
|
||||
const wrapper = mount(Stepper, {
|
||||
propsData: {
|
||||
placeholder: 'foo',
|
||||
},
|
||||
});
|
||||
expect(wrapper.find('.van-stepper__input')).toMatchSnapshot();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user