From 652bff5cb21ea01c7ed83b32d9183caf499fdece Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 11 Sep 2018 15:49:58 +0800 Subject: [PATCH] [bugfix] Cell: remove unworked props (#559) --- packages/cell/README.md | 3 --- packages/cell/index.js | 22 ++++++++++++++++++---- packages/cell/index.pcss | 14 +------------- packages/cell/index.wxml | 16 ++++++++++++---- packages/mixins/observer/props.js | 2 +- 5 files changed, 32 insertions(+), 25 deletions(-) diff --git a/packages/cell/README.md b/packages/cell/README.md index c2745641..f231cda7 100644 --- a/packages/cell/README.md +++ b/packages/cell/README.md @@ -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 | 右侧图标样式类 | diff --git a/packages/cell/index.js b/packages/cell/index.js index cce4c873..99afc390 100644 --- a/packages/cell/index.js +++ b/packages/cell/index.js @@ -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; diff --git a/packages/cell/index.pcss b/packages/cell/index.pcss index 854635d0..6247ee91 100644 --- a/packages/cell/index.pcss +++ b/packages/cell/index.pcss @@ -45,7 +45,7 @@ font-size: 16px; line-height: 24px; margin-right: 5px; - vertical-align:middle; + vertical-align: middle; } &__right-icon { @@ -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 { diff --git a/packages/cell/index.wxml b/packages/cell/index.wxml index c8bbd485..70866015 100644 --- a/packages/cell/index.wxml +++ b/packages/cell/index.wxml @@ -1,12 +1,20 @@ - + - + {{ title }} {{ label }} @@ -20,7 +28,7 @@ diff --git a/packages/mixins/observer/props.js b/packages/mixins/observer/props.js index 98871de1..9f7923f6 100644 --- a/packages/mixins/observer/props.js +++ b/packages/mixins/observer/props.js @@ -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 }; }