<template>
  <div class="x-tab-item" :class="{'x-tab-item--selected': $parent.value === id}" @click="onClick">
    <slot></slot>
  </div>
</template>

<script>
export default {
  props: {
    id: {}
  },
  methods: {
    onClick() {
      this.$parent.$emit('input', this.id)
    }
  }
}
</script>

<style lang="less">
.x-tab-item {
  flex: 1;
  font-size: 17px;
  line-height: 44px;
  text-align: center;
  color: #666;
  box-sizing: border-box;

  &--selected {
    color: #ea5341;
  }
}
</style>
