mirror of
https://github.com/youzan/vant.git
synced 2025-10-22 20:04:09 +00:00
[improvement] Sku: jsx (#2666)
This commit is contained in:
32
packages/sku/components/SkuActions.js
Normal file
32
packages/sku/components/SkuActions.js
Normal 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>
|
||||
);
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user