mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat: migrate GoodsAction component
This commit is contained in:
parent
ee4464b6b0
commit
e2d9b12bd2
@ -77,4 +77,7 @@ module.exports = [
|
|||||||
'coupon-list',
|
'coupon-list',
|
||||||
'coupon-cell',
|
'coupon-cell',
|
||||||
'submit-bar',
|
'submit-bar',
|
||||||
|
'goods-action',
|
||||||
|
'goods-action-icon',
|
||||||
|
'goods-action-button',
|
||||||
];
|
];
|
||||||
|
@ -18,6 +18,8 @@ export default createComponent({
|
|||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
emits: ['click'],
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
isFirst() {
|
isFirst() {
|
||||||
const prev = this.parent && this.parent.children[this.index - 1];
|
const prev = this.parent && this.parent.children[this.index - 1];
|
||||||
@ -55,7 +57,7 @@ export default createComponent({
|
|||||||
disabled={this.disabled}
|
disabled={this.disabled}
|
||||||
onClick={this.onClick}
|
onClick={this.onClick}
|
||||||
>
|
>
|
||||||
{this.slots() || this.text}
|
{this.$slots.default ? this.$slots.default() : this.text}
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -20,6 +20,8 @@ export default createComponent({
|
|||||||
iconClass: null,
|
iconClass: null,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
emits: ['click'],
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onClick(event) {
|
onClick(event) {
|
||||||
this.$emit('click', event);
|
this.$emit('click', event);
|
||||||
@ -27,13 +29,12 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
genIcon() {
|
genIcon() {
|
||||||
const slot = this.slots('icon');
|
|
||||||
const info = isDef(this.badge) ? this.badge : this.info;
|
const info = isDef(this.badge) ? this.badge : this.info;
|
||||||
|
|
||||||
if (slot) {
|
if (this.$slots.icon) {
|
||||||
return (
|
return (
|
||||||
<div class={bem('icon')}>
|
<div class={bem('icon')}>
|
||||||
{slot}
|
{this.$slots.icon()}
|
||||||
<Info dot={this.dot} info={info} />
|
<Info dot={this.dot} info={info} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@ -56,7 +57,7 @@ export default createComponent({
|
|||||||
return (
|
return (
|
||||||
<div role="button" tabindex="0" class={bem()} onClick={this.onClick}>
|
<div role="button" tabindex="0" class={bem()} onClick={this.onClick}>
|
||||||
{this.genIcon()}
|
{this.genIcon()}
|
||||||
{this.slots() || this.text}
|
{this.$slots.default ? this.$slots.default() : this.text}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -16,7 +16,7 @@ export default createComponent({
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div class={bem({ unfit: !this.safeAreaInsetBottom })}>
|
<div class={bem({ unfit: !this.safeAreaInsetBottom })}>
|
||||||
{this.slots()}
|
{this.$slots.default?.()}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -347,10 +347,10 @@ module.exports = {
|
|||||||
path: 'coupon-list',
|
path: 'coupon-list',
|
||||||
title: 'Coupon 优惠券',
|
title: 'Coupon 优惠券',
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// path: 'goods-action',
|
path: 'goods-action',
|
||||||
// title: 'GoodsAction 商品导航',
|
title: 'GoodsAction 商品导航',
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
path: 'submit-bar',
|
path: 'submit-bar',
|
||||||
title: 'SubmitBar 提交订单栏',
|
title: 'SubmitBar 提交订单栏',
|
||||||
@ -681,10 +681,10 @@ module.exports = {
|
|||||||
path: 'coupon-list',
|
path: 'coupon-list',
|
||||||
title: 'Coupon',
|
title: 'Coupon',
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// path: 'goods-action',
|
path: 'goods-action',
|
||||||
// title: 'GoodsAction',
|
title: 'GoodsAction',
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
path: 'submit-bar',
|
path: 'submit-bar',
|
||||||
title: 'SubmitBar',
|
title: 'SubmitBar',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user