1
0
mirror of https://gitee.com/vant-contrib/vant-weapp.git synced 2025-04-06 03:58:05 +08:00

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

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

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

@ -46,16 +46,35 @@
}
&__left-icon-wrap,
&__right-icon-wrap {
&__right-icon-wrap {
display: flex;
align-items: center;
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 {
font-size: 16px !important;
line-height: 24px;
margin-right: 5px;
vertical-align: middle;
}
@ -63,7 +82,6 @@
color: @gray-dark;
font-size: 12px !important;
line-height: 24px;
margin-left: 5px;
}
&--clickable {

@ -24,7 +24,8 @@ VantComponent({
border: {
type: Boolean,
value: true
}
},
arrowDirection: String
},
computed: {
@ -41,6 +42,11 @@ VantComponent({
titleStyle(): string {
const { titleWidth } = this.data;
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}`);
}
},

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