Skip to content

Commit

Permalink
[improvement] Icon: add custom-style prop (#677)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan committed Sep 29, 2018
1 parent b08e90e commit 3e12b21
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
8 changes: 7 additions & 1 deletion packages/checkbox/index.wxml
@@ -1,7 +1,13 @@
<view class="van-checkbox custom-class">
<view class="van-checkbox__icon-wrap" bindtap="toggle">
<slot wx:if="{{ useIconSlot }}" name="icon" />
<van-icon class="{{ iconClass }}" custom-class="icon-class" wx:else name="success" />
<van-icon
wx:else
name="success"
class="{{ iconClass }}"
custom-class="icon-class"
custom-style="line-height: 20px;"
/>
</view>
<view class="van-checkbox__label van-checkbox__label--{{ labelPosition }} label-class" bindtap="onClickLabel">
<slot />
Expand Down
1 change: 1 addition & 0 deletions packages/icon/README.md
Expand Up @@ -27,6 +27,7 @@
| info | 图标右上角文字提示 | `String | Number` | - |
| color | 图标颜色 | `String` | `inherit` |
| size | 图标大小,如 `20px``2em` | `String` | `inherit` |
| custom-style | 自定义样式 | `String` | - |
| class-prefix | 类名前缀 | `String` | `van-icon` |

### Event
Expand Down
1 change: 1 addition & 0 deletions packages/icon/index.ts
Expand Up @@ -6,6 +6,7 @@ VantComponent({
name: String,
size: String,
color: String,
customStyle: String,
classPrefix: {
type: String,
value: 'van-icon'
Expand Down
2 changes: 1 addition & 1 deletion packages/icon/index.wxml
@@ -1,6 +1,6 @@
<view
class="custom-class {{ classPrefix }} {{ classPrefix }}-{{ name }}"
style="{{ color ? 'color: ' + color : '' }}; {{ size ? 'font-size: ' + size : '' }}"
style="{{ color ? 'color: ' + color + ';' : '' }}{{ size ? 'font-size: ' + size + ';' : '' }}{{ customStyle }}"
bind:tap="onClick"
>
<view wx:if="{{ info !== null }}" class="van-icon__info">{{ info }}</view>
Expand Down
2 changes: 1 addition & 1 deletion types/index.d.ts
Expand Up @@ -31,7 +31,7 @@ export type CombinedComponentInstance<
Weapp.Component &
Weapp.FormField &
ComponentInstance & {
data: Data & RecordToAny<Props> & RecordToReturn<Computed>;
data: Data & LooseObject & RecordToAny<Props> & RecordToReturn<Computed>;
};

export type VantComponentOptions<
Expand Down

0 comments on commit 3e12b21

Please sign in to comment.