[improvement] Sku: jsx (#2666)

This commit is contained in:
neverland
2019-02-01 21:50:47 +08:00
committed by GitHub
parent 7ee383129c
commit 3958a42484
13 changed files with 458 additions and 526 deletions

View File

@@ -0,0 +1,32 @@
import { use } from '../../utils';
import Button from '../../button';
const [sfc, bem] = use('sku-actions');
export default sfc({
props: {
buyText: String,
skuEventBus: Object,
showAddCartBtn: Boolean
},
render(h) {
const emit = name => () => {
this.skuEventBus.$emit('sku:addCart');
};
return (
<div class={bem()}>
{this.showAddCartBtn && (
<Button bottomAction text="加入购物车" onClick={emit('sku:addCart')} />
)}
<Button
type="primary"
bottomAction
text={this.buyText || '立即购买'}
onClick={emit('sku:buy')}
/>
</div>
);
}
});