[new feature] Field: add size prop (#2936)

This commit is contained in:
neverland 2019-03-11 09:13:23 +08:00 committed by GitHub
parent cb72fef807
commit e553c6e0dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 0 deletions

View File

@ -118,6 +118,7 @@ Field support all native properties of input tagsuch as `maxlength`、`placeh
| value | Field value | `String | Number` | - |
| label | Field label | `String` | - |
| type | Input type | `String` | `text` |
| size | Sizecan be set to `large` | `String` | - |
| border | Whether to show inner border | `Boolean` | `true` |
| disabled | Whether to disable field | `Boolean` | `false` |
| readonly | Whether to be readonly | `Boolean` | `false` |

View File

@ -10,6 +10,7 @@ export default sfc({
props: {
...cellProps,
size: String,
error: Boolean,
leftIcon: String,
rightIcon: String,
@ -222,6 +223,7 @@ export default sfc({
return (
<Cell
icon={this.leftIcon}
size={this.size}
title={this.label}
center={this.center}
border={this.border}

View File

@ -44,3 +44,11 @@ exports[`render textarea 1`] = `
</div>
</div>
`;
exports[`size prop 1`] = `
<div class="van-cell van-cell--large van-field">
<div class="van-cell__value van-cell__value--alone">
<div class="van-field__body"><input type="text" class="van-field__control"></div>
</div>
</div>
`;

View File

@ -187,3 +187,12 @@ test('render right icon with icon prop for old version', () => {
});
expect(wrapper).toMatchSnapshot();
});
test('size prop', () => {
const wrapper = mount(Field, {
propsData: {
size: 'large'
}
});
expect(wrapper).toMatchSnapshot();
});

View File

@ -120,6 +120,7 @@ Field 默认支持 Input 标签所有的原生属性,比如 `maxlength`、`pla
| label | 输入框左侧文本 | `String` | - | - |
| value | 当前输入的值 | `String | Number` | - | - |
| type | 可设置为原生类型, 如 `number` `tel` `textarea` | `String` | `text` | - |
| size | 大小,可选值为 `large` | `String` | - | 1.6.9 |
| border | 是否显示内边框 | `Boolean` | `true` | - |
| disabled | 是否禁用输入框 | `Boolean` | `false` | - |
| readonly | 是否只读 | `Boolean` | `false` | - |