mirror of
https://github.com/youzan/vant.git
synced 2026-04-05 02:05:11 +08:00
feat: migrate GoodsAction component
This commit is contained in:
@@ -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>
|
||||
);
|
||||
},
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
},
|
||||
|
||||
@@ -16,7 +16,7 @@ export default createComponent({
|
||||
render() {
|
||||
return (
|
||||
<div class={bem({ unfit: !this.safeAreaInsetBottom })}>
|
||||
{this.slots()}
|
||||
{this.$slots.default?.()}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user