diff --git a/components.js b/components.js index 7eb55865c..e061b9047 100644 --- a/components.js +++ b/components.js @@ -77,4 +77,7 @@ module.exports = [ 'coupon-list', 'coupon-cell', 'submit-bar', + 'goods-action', + 'goods-action-icon', + 'goods-action-button', ]; diff --git a/src/goods-action-button/index.js b/src/goods-action-button/index.js index 39f8e974e..fbb3d63d6 100644 --- a/src/goods-action-button/index.js +++ b/src/goods-action-button/index.js @@ -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} ); }, diff --git a/src/goods-action-icon/index.js b/src/goods-action-icon/index.js index b9bb118dc..dff2835e0 100644 --- a/src/goods-action-icon/index.js +++ b/src/goods-action-icon/index.js @@ -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 (