Badge.vue 805 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <script>
  2. export default {
  3. functional: true,
  4. props: {
  5. type: {
  6. type: String,
  7. default: 'tip'
  8. },
  9. text: String,
  10. vertical: {
  11. type: String,
  12. default: 'top'
  13. }
  14. },
  15. render (h, { props, slots }) {
  16. return h('span', {
  17. class: ['badge', props.type],
  18. style: {
  19. verticalAlign: props.vertical
  20. }
  21. }, props.text || slots().default)
  22. }
  23. }
  24. </script>
  25. <style lang="stylus" scoped>
  26. .badge
  27. display inline-block
  28. font-size 14px
  29. height 18px
  30. line-height 18px
  31. border-radius 3px
  32. padding 0 6px
  33. color white
  34. background-color #42b983
  35. &.tip, &.green
  36. background-color $badgeTipColor
  37. &.error
  38. background-color $badgeErrorColor
  39. &.warning, &.warn, &.yellow
  40. background-color $badgeWarningColor
  41. & + &
  42. margin-left 5px
  43. </style>