[bugfix] Cell: remove unworked props (#559)

This commit is contained in:
neverland 2018-09-11 15:49:58 +08:00 committed by GitHub
parent 77e3a21448
commit 652bff5cb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 25 deletions

View File

@ -106,7 +106,6 @@
| clickable | 是否开启点击反馈 | `Boolean` | `false` |
| is-link | 是否展示右侧箭头并开启点击反馈 | `Boolean` | `false` |
| required | 是否显示表单必填星号 | `Boolean` | `false` |
| arrow-direction | 箭头方向,可选值为 `left` `up` `down` | `String` | - |
### Cell Event
@ -131,5 +130,3 @@
| title-class | 标题样式类 |
| label-class | 描述信息样式类 |
| value-class | 右侧内容样式类 |
| left-icon-class | 左侧图标样式类 |
| right-icon-class | 右侧图标样式类 |

View File

@ -4,9 +4,7 @@ create({
classes: [
'title-class',
'label-class',
'value-class',
'left-icon-class',
'right-icon-class'
'value-class'
],
props: {
@ -21,7 +19,6 @@ create({
clickable: Boolean,
titleWidth: String,
customStyle: String,
arrowDirection: String,
linkType: {
type: String,
value: 'navigateTo'
@ -32,6 +29,23 @@ create({
}
},
computed: {
cellClass() {
const { data } = this;
return this.classNames('custom-class', 'van-cell', {
'van-hairline': data.border,
'van-cell--center': data.center,
'van-cell--required': data.required,
'van-cell--clickable': data.isLink || data.clickable
});
},
titleStyle() {
const { titleWidth } = this.data;
return titleWidth ? `max-width: ${titleWidth};min-width: ${titleWidth}` : '';
}
},
methods: {
onClick() {
const { url } = this.data;

View File

@ -53,18 +53,6 @@
font-size: 12px;
line-height: 24px;
margin-left: 5px;
&--left::before {
transform: rotate(180deg);
}
&--up::before {
transform: rotate(-90deg);
}
&--down::before {
transform: rotate(90deg);
}
}
&--clickable {

View File

@ -1,12 +1,20 @@
<view
class="custom-class van-cell {{ center ? 'van-cell--center' : '' }} {{ required ? 'van-cell--required' : '' }} {{ isLink || clickable ? 'van-cell--clickable' : '' }} {{ border ? 'van-hairline' : '' }}"
class="{{ cellClass }}"
style="{{ customStyle }}"
bind:tap="onClick"
>
<van-icon wx:if="{{ icon }}" custom-class="van-cell__left-icon left-icon-class" name="{{ icon }}" />
<van-icon
wx:if="{{ icon }}"
name="{{ icon }}"
custom-class="van-cell__left-icon"
/>
<slot wx:else name="icon" />
<view wx:if="{{ title }}" class="van-cell__title title-class" style="{{ titleWidth ? 'max-width: ' + titleWidth + ';min-width: ' + titleWidth : '' }}">
<view
wx:if="{{ title }}"
style="{{ titleStyle }}"
class="van-cell__title title-class"
>
{{ title }}
<view wx:if="{{ label }}" class="van-cell__label label-class">{{ label }}</view>
</view>
@ -20,7 +28,7 @@
<van-icon
wx:if="{{ isLink }}"
name="arrow"
custom-class="van-cell__right-icon right-icon-class {{ arrowDirection ? 'van-cell__right-icon--' + arrowDirection : '' }}"
custom-class="van-cell__right-icon"
/>
<slot wx:else name="right-icon" />

View File

@ -5,7 +5,7 @@ export function observeProps(props) {
Object.keys(props).forEach(key => {
let prop = props[key];
if (!prop.type) {
if (prop === null || !prop.type) {
prop = { type: prop };
}