diff --git a/docs/app/pages/Components/Badge/Badge.vue b/docs/app/pages/Components/Badge/Badge.vue index 0223217b4..1aee32cf9 100644 --- a/docs/app/pages/Components/Badge/Badge.vue +++ b/docs/app/pages/Components/Badge/Badge.vue @@ -49,7 +49,8 @@ { name: 'md-content', type: 'String, Number', - description: 'A content for badge' + description: 'A content for badge', + defaults: ' ' }, { name: 'md-position', diff --git a/src/components/MdBadge/MdBadge.vue b/src/components/MdBadge/MdBadge.vue index 20c3181d6..aede4059f 100644 --- a/src/components/MdBadge/MdBadge.vue +++ b/src/components/MdBadge/MdBadge.vue @@ -1,13 +1,13 @@ @@ -40,9 +40,27 @@ return !!this.$slots.default }, badgeClasses () { + const staticClass = this.$vnode.data.staticClass ? + this.$vnode.data.staticClass.split(' ').filter(val => val).reduce((result, key) => { + result[key] = true + return result + }, {}) : {} + + const dynamicClass = this.$vnode.data.class + return { ['md-position-' + this.mdPosition]: true, - 'md-dense': this.mdDense + 'md-dense': this.mdDense, + ...staticClass, + ...dynamicClass + } + }, + styles () { + const staticStyle = this.$vnode.data.staticStyle + const style = this.$vnode.data.style + return { + ...staticStyle, + ...style } } }