From 2cb5e5e566988eff5642cf114899078459d49501 Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Sun, 22 Nov 2020 16:12:41 +0800 Subject: [PATCH] chore: remove legacy badge --- src/badge/index.js | 69 ---------------------------------------------- 1 file changed, 69 deletions(-) delete mode 100644 src/badge/index.js diff --git a/src/badge/index.js b/src/badge/index.js deleted file mode 100644 index 652e5184b..000000000 --- a/src/badge/index.js +++ /dev/null @@ -1,69 +0,0 @@ -import { isDef, createNamespace } from '../utils'; -import { isNumeric } from '../utils/validate/number'; - -const [createComponent, bem] = createNamespace('badge'); - -export default createComponent({ - props: { - dot: Boolean, - max: [Number, String], - color: String, - content: [Number, String], - tag: { - type: String, - default: 'div', - }, - }, - - methods: { - hasContent() { - return !!( - this.$scopedSlots.content || - (isDef(this.content) && this.content !== '') - ); - }, - - renderContent() { - const { dot, max, content } = this; - - if (!dot && this.hasContent()) { - if (this.$scopedSlots.content) { - return this.$scopedSlots.content(); - } - - if (isDef(max) && isNumeric(content) && +content > max) { - return `${max}+`; - } - - return content; - } - }, - - renderBadge() { - if (this.hasContent() || this.dot) { - return ( -
- {this.renderContent()} -
- ); - } - }, - }, - - render() { - if (this.$scopedSlots.default) { - const { tag } = this; - return ( - - {this.$scopedSlots.default()} - {this.renderBadge()} - - ); - } - - return this.renderBadge(); - }, -});