[new feature] Cell: 增加 arrow-direction 属性 (#866)

This commit is contained in:
rex 2018-11-06 19:13:58 +08:00 committed by neverland
parent 16b569971f
commit 0cff00bdcc
4 changed files with 30 additions and 5 deletions

View File

@ -106,6 +106,7 @@
| clickable | 是否开启点击反馈 | `Boolean` | `false` | | clickable | 是否开启点击反馈 | `Boolean` | `false` |
| is-link | 是否展示右侧箭头并开启点击反馈 | `Boolean` | `false` | | is-link | 是否展示右侧箭头并开启点击反馈 | `Boolean` | `false` |
| required | 是否显示表单必填星号 | `Boolean` | `false` | | required | 是否显示表单必填星号 | `Boolean` | `false` |
| arrow-direction | 箭头方向,可选值为 `left` `up` `down` | `String` | - |
### Cell Event ### Cell Event

View File

@ -46,16 +46,35 @@
} }
&__left-icon-wrap, &__left-icon-wrap,
&__right-icon-wrap { &__right-icon-wrap {
display: flex; display: flex;
align-items: center; align-items: center;
height: 24px; height: 24px;
} }
&__left-icon-wrap {
margin-right: 5px;
}
&__right-icon-wrap {
margin-left: 5px;
&--left {
transform: rotate(180deg);
}
&--up {
transform: rotate(-90deg);
}
&--down {
transform: rotate(90deg);
}
}
&__left-icon { &__left-icon {
font-size: 16px !important; font-size: 16px !important;
line-height: 24px; line-height: 24px;
margin-right: 5px;
vertical-align: middle; vertical-align: middle;
} }
@ -63,7 +82,6 @@
color: @gray-dark; color: @gray-dark;
font-size: 12px !important; font-size: 12px !important;
line-height: 24px; line-height: 24px;
margin-left: 5px;
} }
&--clickable { &--clickable {

View File

@ -24,7 +24,8 @@ VantComponent({
border: { border: {
type: Boolean, type: Boolean,
value: true value: true
} },
arrowDirection: String
}, },
computed: { computed: {
@ -41,6 +42,11 @@ VantComponent({
titleStyle(): string { titleStyle(): string {
const { titleWidth } = this.data; const { titleWidth } = this.data;
return titleWidth ? `max-width: ${titleWidth};min-width: ${titleWidth}` : ''; return titleWidth ? `max-width: ${titleWidth};min-width: ${titleWidth}` : '';
},
iconWrapClass(): string {
const prefix = 'van-cell__right-icon-wrap';
return this.classNames(prefix, `${prefix}--${this.data.arrowDirection}`);
} }
}, },

View File

@ -30,7 +30,7 @@
<van-icon <van-icon
wx:if="{{ isLink }}" wx:if="{{ isLink }}"
name="arrow" name="arrow"
class="van-cell__right-icon-wrap" class="{{ iconWrapClass }}"
custom-class="van-cell__right-icon" custom-class="van-cell__right-icon"
/> />
<slot wx:else name="right-icon" /> <slot wx:else name="right-icon" />