<template>
  <view v-if="type === 'default'" @click="click" class="action cu-bar-item">
    <slot>
      <l-icon :type="icon" :color="color" size="lg" class="cuIcon-cu-image" />
      <slot name="badge"></slot>
      <view :class="'text-' + color">
        <slot name="title">{{ title }}</slot>
      </view>
    </slot>
  </view>

  <view v-else-if="type === 'round'" class="action text-gray add-action cu-bar-item">
    <slot>
      <button :class="['bg-' + color, 'cuIcon-' + icon]" class="cu-btn shadow"></button>
      <slot name="title">{{ title }}</slot>
    </slot>
  </view>
</template>

<script>
export default {
  name: 'l-bar-item',

  props: {
    type: { default: 'default' },
    title: {},
    icon: {},
    color: { default: 'gray' }
  },

  methods: {
    click(e) {
      this.$emit('click', e)
    }
  }
}
</script>
