This repository was archived by the owner on Oct 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- v1.0.0-beta.16
- v1.0.0-beta.13
- v1.0.0-beta.12
- v1.0.0-beta.11
- v1.0.0-beta.10
- v1.0.0-beta.9
- v1.0.0-beta.8
- v1.0.0-beta.7
- v1.0.0-beta.6
- v1.0.0-beta.5
- v1.0.0-beta.4
- v1.0.0-beta.3
- v1.0.0-beta.2
- v1.0.0-beta.1
- v1.0.0-alpha.15
- v1.0.0-alpha.14
- v1.0.0-alpha.13
- v1.0.0-alpha.12
- v1.0.0-alpha.11
- v1.0.0-alpha.10
- v1.0.0-alpha.9
- v1.0.0-alpha.8
- v1.0.0-alpha.7
- v1.0.0-alpha.6
- v1.0.0-alpha.5
- v1.0.0-alpha.4
- v1.0.0-alpha.3
- v1.0.0-alpha.2
- v1.0.0-alpha.1
- v1.0.0-alpha.0
- v0.0.10
pengshanglong
committed
May 13, 2020
1 parent
2a4b68c
commit dea1d1a
Showing
3 changed files
with
117 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import classNames from 'classnames' | ||
|
||
export default { | ||
name: 'Card', | ||
props: { | ||
note: { | ||
type: String, | ||
default: '', | ||
}, | ||
isFull: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
thumb: { | ||
type: String, | ||
default: '', | ||
}, | ||
title: { | ||
type: String, | ||
default: '', | ||
}, | ||
extra: { | ||
type: String, | ||
default: '', | ||
}, | ||
icon: { | ||
type: Object, | ||
default: () => {}, | ||
}, | ||
onClick: { | ||
type: Function, | ||
default: () => () => {}, | ||
}, | ||
renderIcon: { | ||
type: String, | ||
default: '', | ||
}, | ||
extraStyle: { | ||
type: Object, | ||
default: () => {}, | ||
}, | ||
className: { | ||
type: [String, Array], | ||
default: '', | ||
}, | ||
}, | ||
methods: { | ||
handleClick(args) { | ||
if (typeof this.onClick === 'function') { | ||
this.onClick(args) | ||
} | ||
}, | ||
}, | ||
render() { | ||
const { title, note, extra, extraStyle, thumb, isFull, icon, renderIcon } = this | ||
|
||
const rootClass = classNames( | ||
'at-card', | ||
{ | ||
'at-card--full': isFull, | ||
}, | ||
this.className | ||
) | ||
const iconClass = classNames({ | ||
'at-icon': true, | ||
[`at-icon-${icon && icon.value}`]: icon && icon.value, | ||
'at-card__header-icon': true, | ||
}) | ||
|
||
const iconStyle = { | ||
color: (icon && icon.color) || '', | ||
fontSize: (icon && `${icon.size}px`) || '', | ||
} | ||
|
||
return ( | ||
<view onClick={this.handleClick} class={rootClass}> | ||
<view class="at-card__header"> | ||
{thumb && ( | ||
<view class="at-card__header-thumb"> | ||
<image class="at-card__header-thumb-info" mode="scaleToFill" src={thumb} /> | ||
</view> | ||
)} | ||
{renderIcon || this.$slots.renderIcon || ''} | ||
{!thumb && icon && icon.value && <view class={iconClass} style={iconStyle}></view>} | ||
|
||
<view class="at-card__header-title">{title}</view> | ||
{extra && ( | ||
<view style={{ ...extraStyle }} class="at-card__header-extra"> | ||
{extra} | ||
</view> | ||
)} | ||
</view> | ||
<view class="at-card__content"> | ||
<view class="at-card__content-info">{this.$slots.default}</view> | ||
{note && <view class="at-card__content-note">{note}</view>} | ||
</view> | ||
</view> | ||
) | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import Grid from './grid/index' | ||
import List from './list/index' | ||
import ListItem from './list/item/index' | ||
import Card from './card/index' | ||
|
||
export { Grid, List, ListItem } | ||
export { Grid, List, ListItem, Card } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters