diff --git a/src/action-bar-button/index.js b/src/action-bar-button/index.js index 77d819131..f145032ad 100644 --- a/src/action-bar-button/index.js +++ b/src/action-bar-button/index.js @@ -18,47 +18,35 @@ export default createComponent({ disabled: Boolean, }, - emits: ['click'], + setup(props, { slots }) { + return (vm) => { + const { type, icon, text, color, loading, disabled } = props; - computed: { - isFirst() { - const prev = this.parent && this.parent.children[this.index - 1]; - return !prev || prev.$options.name !== this.$options.name; - }, + const { parent } = vm; + const { name } = vm.$options; + const prev = parent && parent.children[vm.index - 1]; + const next = parent && parent.children[vm.index + 1]; + const last = !next || name !== next.$options.name; + const first = !prev || name !== prev.$options.name; - isLast() { - const next = this.parent && this.parent.children[this.index + 1]; - return !next || next.$options.name !== this.$options.name; - }, - }, + const onClick = () => { + route(vm.$router, vm); + }; - methods: { - onClick(event) { - this.$emit('click', event); - route(this.$router, this); - }, - }, - - render() { - return ( - - ); + return ( + + ); + }; }, }); diff --git a/src/action-bar-icon/index.js b/src/action-bar-icon/index.js index c47dee5bf..170bebac0 100644 --- a/src/action-bar-icon/index.js +++ b/src/action-bar-icon/index.js @@ -19,42 +19,42 @@ export default createComponent({ iconClass: null, }, - emits: ['click'], + setup(props, { slots }) { + function genIcon() { + const { dot, badge, icon, color, iconClass } = props; - methods: { - onClick(event) { - this.$emit('click', event); - route(this.$router, this); - }, - - genIcon() { - if (this.$slots.icon) { + if (slots.icon) { return (