[improvement] reduce simple computed (#2530)

This commit is contained in:
neverland
2019-01-15 21:58:29 +08:00
committed by GitHub
parent f41b9d3bd3
commit 1d2bd12fef
4 changed files with 45 additions and 57 deletions

View File

@@ -14,12 +14,6 @@ export default sfc({
arrowDirection: String
},
computed: {
arrowIcon() {
return this.arrowDirection ? `arrow-${this.arrowDirection}` : 'arrow';
}
},
methods: {
onClick() {
this.$emit('click');
@@ -49,8 +43,9 @@ export default sfc({
this.icon && <Icon class={bem('left-icon')} name={this.icon} />
);
const arrowIcon = this.arrowDirection ? `arrow-${this.arrowDirection}` : 'arrow';
const RightIcon = slots['right-icon'] || (
this.isLink && <Icon class={bem('right-icon')} name={this.arrowIcon} />
this.isLink && <Icon class={bem('right-icon')} name={arrowIcon} />
);
return (