[improvement] Panel: jsx (#2587)

This commit is contained in:
neverland
2019-01-22 21:46:31 +08:00
committed by GitHub
parent b2d86faa05
commit 11cb38b65c
3 changed files with 35 additions and 39 deletions

34
packages/panel/index.js Normal file
View File

@@ -0,0 +1,34 @@
import { use } from '../utils';
import Cell from '../cell';
import CellGroup from '../cell-group';
const [sfc, bem] = use('panel');
export default sfc({
props: {
icon: String,
desc: String,
title: String,
status: String
},
render(h) {
const slots = this.$slots;
return (
<CellGroup class={bem()}>
{slots.header || (
<Cell
class={bem('header')}
icon={this.icon}
label={this.desc}
title={this.title}
value={this.status}
/>
)}
<div class={bem('content')}>{slots.default}</div>
{slots.footer && <div class={[bem('footer'), 'van-hairline--top']}>{slots.footer}</div>}
</CellGroup>
);
}
});