<template>
  <div>
    <button
      v-if="!btnBg"
      @click="$emit('click')"
      class="lx-button"
      :style="{color: color, background: bg}"
      :disabled="disabled"
      :class="[
      'lx-button--'+type,
      {'is-plain': plain, 'is-disabled': disabled, 'is-round': round},
      'lx-button--size-'+size
      ]">
      <img v-if="icon !== ''" :class="icon" :src="icon"/>
      <slot></slot>
    </button>
    <div v-else class="lx-button_img">
      <img @click="$emit('click')" v-if="btnBg[2]" :src="btnBg[1]"/>
      <img @click="$emit('click')" v-else :src="btnBg[0]"/>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'lxButton',
    props: {
      color: {
        type: String,
        default: ''
      },
      bg: {
        type: String,
        default: ''
      },
      type: {
        type: String,
        default: 'primary'
      },
      size: {
        type: String,
        default: 'default'
      },
      icon: {
        type: String,
        default: ''
      },
      btnBg: {
        type: Array
      },
      plain: Boolean,
      disabled: Boolean,
      round: Boolean
    },
    data() {
      return {
        msg: 'button'
      }
    }
  }
</script>

