feat: migrate GoodsAction component

This commit is contained in:
chenjiahan 2020-08-18 17:09:46 +08:00
parent ee4464b6b0
commit e2d9b12bd2
5 changed files with 20 additions and 14 deletions

View File

@ -77,4 +77,7 @@ module.exports = [
'coupon-list',
'coupon-cell',
'submit-bar',
'goods-action',
'goods-action-icon',
'goods-action-button',
];

View File

@ -18,6 +18,8 @@ export default createComponent({
disabled: Boolean,
},
emits: ['click'],
computed: {
isFirst() {
const prev = this.parent && this.parent.children[this.index - 1];
@ -55,7 +57,7 @@ export default createComponent({
disabled={this.disabled}
onClick={this.onClick}
>
{this.slots() || this.text}
{this.$slots.default ? this.$slots.default() : this.text}
</Button>
);
},

View File

@ -20,6 +20,8 @@ export default createComponent({
iconClass: null,
},
emits: ['click'],
methods: {
onClick(event) {
this.$emit('click', event);
@ -27,13 +29,12 @@ export default createComponent({
},
genIcon() {
const slot = this.slots('icon');
const info = isDef(this.badge) ? this.badge : this.info;
if (slot) {
if (this.$slots.icon) {
return (
<div class={bem('icon')}>
{slot}
{this.$slots.icon()}
<Info dot={this.dot} info={info} />
</div>
);
@ -56,7 +57,7 @@ export default createComponent({
return (
<div role="button" tabindex="0" class={bem()} onClick={this.onClick}>
{this.genIcon()}
{this.slots() || this.text}
{this.$slots.default ? this.$slots.default() : this.text}
</div>
);
},

View File

@ -16,7 +16,7 @@ export default createComponent({
render() {
return (
<div class={bem({ unfit: !this.safeAreaInsetBottom })}>
{this.slots()}
{this.$slots.default?.()}
</div>
);
},

View File

@ -347,10 +347,10 @@ module.exports = {
path: 'coupon-list',
title: 'Coupon 优惠券',
},
// {
// path: 'goods-action',
// title: 'GoodsAction 商品导航',
// },
{
path: 'goods-action',
title: 'GoodsAction 商品导航',
},
{
path: 'submit-bar',
title: 'SubmitBar 提交订单栏',
@ -681,10 +681,10 @@ module.exports = {
path: 'coupon-list',
title: 'Coupon',
},
// {
// path: 'goods-action',
// title: 'GoodsAction',
// },
{
path: 'goods-action',
title: 'GoodsAction',
},
{
path: 'submit-bar',
title: 'SubmitBar',