<!--
 * @Descripttion:
 * @Version: 1.0
 * @Author: +C
 * @Date: 2022-02-17 12:54:27
 * @LastEditors: wufz
 * @LastEditTime: 2023-01-09 17:19:31
-->

<template>
  <vxe-radio v-if="!radioIsDetai" v-bind="$attrs" v-on="$listeners"></vxe-radio>
  <span v-else>{{ formVal }} </span>
</template>

<script>
import formComponents from "./formComponents"
export default {
  name: 'DxxRadio',
  //页面引用的组件
  components: {},
  //继承表单父组件
  extends: formComponents,
  //父页面传递参数
  props: {},
  data() {
    return {};
  },
  //监控计算变量
  computed: {

    //单选是否详细
    radioIsDetai: function () {

      //先判断父节点是不是group，获取group的isdetail
      let parent = this.$parent.$vnode
      // console.log(parent.tag)
      if (parent.tag.indexOf('RadioGroup') != -1 && parent.data.attrs.hasOwnProperty('is-detail')) {
        //group有dtail，以他为主
        return parent.data.attrs['is-detail']
      }
      return this.isDetail
    },

    // 计算属性的
    formVal: function () {

      let showTxt = this.$attrs.value == this.$attrs.label ? this.$attrs.content : ''
      return showTxt
    }
  },
  //监听
  watch: {},
  //页面的构造方法
  created() { },
  //父页面定义方法给子页面inject调用
  providee() { return {} },
  //子组件调用注入到父页面providee
  inject: [],
  //dom加载完
  mounted() {
    // console.log(this);
  },
  //页面的自定义方法
  methods: {

  }
};
</script>

<style scoped>
</style>
