[new feature] Field: add arrow-direction prop (#3679)
This commit is contained in:
@@ -134,6 +134,7 @@ Field support all native properties of input tag,such as `maxlength`、`placeh
|
||||
| clearable | Whether to be clearable | `Boolean` | `false` |
|
||||
| clickable | Whether to show click feedback when clicked | `Boolean` | `false` |
|
||||
| is-link | Whether to show link icon | `Boolean` | `false` |
|
||||
| arrow-direction | Can be set to `left` `up` `down` | `String` | - |
|
||||
| error | Whether to show error info | `Boolean` | `false` |
|
||||
| error-message | Error message | `String` | `''` |
|
||||
| label-class | Label className | `any` | - |
|
||||
|
||||
@@ -134,17 +134,18 @@ Field 默认支持 Input 标签所有的原生属性,比如 `maxlength`、`pla
|
||||
| disabled | 是否禁用输入框 | `Boolean` | `false` | - |
|
||||
| readonly | 是否只读 | `Boolean` | `false` | - |
|
||||
| required | 是否显示表单必填星号 | `Boolean` | `false` | - |
|
||||
| clearable | 是否启用清除控件 | `Boolean` | `false` | 1.1.9 |
|
||||
| clearable | 是否启用清除控件 | `Boolean` | `false` | - |
|
||||
| clickable | 是否开启点击反馈 | `Boolean` | `false` | 2.0.0 |
|
||||
| is-link | 是否展示右侧箭头并开启点击反馈 | `Boolean` | `false` | 1.1.10 |
|
||||
| is-link | 是否展示右侧箭头并开启点击反馈 | `Boolean` | `false` | - |
|
||||
| arrow-direction | 箭头方向,可选值为 `left` `up` `down` | `String` | - | 2.0.4 |
|
||||
| error | 是否将输入内容标红 | `Boolean` | `false` | - |
|
||||
| error-message | 底部错误提示文案,为空时不展示 | `String` | `''` | -
|
||||
| label-class | 左侧文本额外类名 | `any` | - | 2.0.0 |
|
||||
| label-width | 左侧文本宽度,可指定单位,默认为 px | `String | Number` | `90px` | 1.6.17 |
|
||||
| label-align | 左侧文本对齐方式,可选值为 `center` `right` | `String` | `left` | 1.1.10 |
|
||||
| input-align | 输入框内容对齐方式,可选值为 `center` `right` | `String` | `left` | 1.1.10 |
|
||||
| label-align | 左侧文本对齐方式,可选值为 `center` `right` | `String` | `left` | - |
|
||||
| input-align | 输入框内容对齐方式,可选值为 `center` `right` | `String` | `left` | - |
|
||||
| error-message-align | 错误提示文案对齐方式,可选值为 `center` `right` | `String` | `left` | 1.6.11 |
|
||||
| autosize | 自适应内容高度,只对 textarea 有效,可传入对象,<br>如 { maxHeight: 100, minHeight: 50 },单位为 px | `Boolean | Object` | `false` | 1.0.0 |
|
||||
| autosize | 自适应内容高度,只对 textarea 有效,可传入对象,<br>如 { maxHeight: 100, minHeight: 50 },单位为 px | `Boolean | Object` | `false` | - |
|
||||
| left-icon | 输入框左侧图标名称或图片链接,可选值见 Icon 组件 | `String` | - | 1.5.7 |
|
||||
| right-icon | 输入框尾部图标名称或图片链接,可选值见 Icon 组件 | `String` | - | 1.5.7 |
|
||||
|
||||
|
||||
@@ -292,6 +292,7 @@ export default createComponent({
|
||||
clickable={this.clickable}
|
||||
titleStyle={this.labelStyle}
|
||||
titleClass={[bem('label', labelAlign), this.labelClass]}
|
||||
arrowDirection={this.arrowDirection}
|
||||
class={bem({
|
||||
error: this.error,
|
||||
disabled: this.$attrs.disabled,
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`arrow-direction prop 1`] = `
|
||||
<div class="van-cell van-cell--clickable 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><i class="van-icon van-icon-arrow-up van-cell__right-icon">
|
||||
<!----></i>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`clearable 1`] = `
|
||||
<div class="van-cell van-field">
|
||||
<div class="van-cell__value van-cell__value--alone">
|
||||
|
||||
@@ -235,3 +235,13 @@ test('label-class prop', () => {
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('arrow-direction prop', () => {
|
||||
const wrapper = mount(Field, {
|
||||
propsData: {
|
||||
isLink: true,
|
||||
arrowDirection: 'up'
|
||||
}
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user