<template>
  <div class="module">
    <div class="el_input_focus1">
      <span class="spanTitle1">{{ title }}</span>
      <van-radio-group
        v-model="internalValue"
        direction="horizontal"
        @input="ins"
      >
        <van-radio
          checked-color="#1c4990"
          v-for="(item, index) in option"
          :key="index"
          :name="item.id"
          >{{ item.name }}</van-radio
        >
      </van-radio-group>
      <b v-if="verify" class="verify">*</b>
    </div>
  </div>
</template>

<script>
export default {
  props: ['title', 'value', 'verify', 'option'],
  name: 'Radio',
  data () {
    return {
      className: 'el_input_focus',
      internalValue: this.value,
      reminder: false
    }
  },
  watch: {
    value (cur, old) {
      if (cur) {
        this.internalValue = cur
        this.blur()
      }
    }
  },
  mounted () {

  },

  methods: {
    ins (val) {
      console.log(val, 'val')
      this.$emit('input', val)
    },
    focus () {
      if (!this.value || this.value === '@#%__+!') {
        this.className = 'el_input_blur'
      }
    },
    blur () {
      if (this.verify) {
        if (this.value) {
          this.className = 'el_input_focus1'
        } else {
          this.className = 'el_input_focusTrue'
        }
      } else {
        if (this.value) {
          this.className = 'el_input_focus1'
        } else {
          this.className = 'el_input_focus'
        }
      }
    }
  }
}
</script>

<style lang="less" scoped></style>
