<template>
  <el-radio-group v-model="condition.value" size="mini" @change="itemAction" class="mx-condition">
    <el-radio-button v-for="item in condition.list" :key="item.code" :label="item.code">
      {{ item.label }}
    </el-radio-button>
  </el-radio-group>
</template>

<script>
export default {
  name: 'mx-condition-button-group',
  props: {
    condition: {
      type: Object,
      default: _ => ({})
    },
    labelWidth: {
      type: String,
      default: '60px'
    }
  },
  methods: {
    itemAction(value) {
      this.$emit('conditionChanged', this.condition.key, value)
    }
  }
}
</script>

<style scoped>
.mx-condition /deep/.el-radio-button {
  margin: 2px 4px;
}

.mx-condition .el-radio-button:first-child /deep/.el-radio-button__inner,
.mx-condition .el-radio-button:last-child /deep/.el-radio-button__inner,
.mx-condition /deep/.el-radio-button__inner {
  /*padding: 5px 15px;*/
  border: 1px solid #DEDEDE;
  border-radius: 14px;
  font-weight: bold;
}

.mx-condition /deep/.el-radio-button__orig-radio:checked + .el-radio-button__inner {
  border-color: #47C6A2;
}
</style>
