You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bar-item.vue 1016 B

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839
  1. <template>
  2. <view v-if="type === 'default'" @click="click" :class="className" :style="style" class="action cu-bar-item">
  3. <slot v-if="$slots.$default"></slot>
  4. <template v-else>
  5. <l-icon :type="icon" :color="color" size="lg" class="cuIcon-cu-image" />
  6. <slot name="badge"></slot>
  7. <view :class="'text-' + color">
  8. <slot name="title">{{ title }}</slot>
  9. </view>
  10. </template>
  11. </view>
  12. <view v-else-if="type === 'round'" :class="className" :style="style" class="action text-gray add-action cu-bar-item">
  13. <slot v-if="$slots.$default"></slot>
  14. <template v-else>
  15. <button :class="['bg-' + color, 'cuIcon-' + icon]" class="cu-btn shadow"></button>
  16. <slot name="title">{{ title }}</slot>
  17. </template>
  18. </view>
  19. </template>
  20. <script>
  21. export default {
  22. name: 'l-bar-item',
  23. props: {
  24. type: { default: 'default' },
  25. title: {},
  26. icon: {},
  27. color: { default: 'gray' }
  28. },
  29. methods: {
  30. click(e) {
  31. this.$emit('click', e)
  32. }
  33. }
  34. }
  35. </script>