<!--
 * @Descripttion:
 * @Version: 1.0
 * @Author: lr
 * @Date: 2022-02-16 09:20:40
 * @LastEditors: wufz
 * @LastEditTime: 2023-01-12 14:37:01
-->

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

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

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

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

    //计算属性的
    formVal: function () {
      var a = []
      if (this.$attrs.value === true) {
        a.push(this.$attrs.content)
      }
      let radioVal = a.length > 0 ? a.join(' ') : ''
      return radioVal
    }
  },
  //监听
  watch: {},
  //页面的构造方法
  created() { },
  //父页面定义方法给子页面inject调用
  provide() { return {} },
  //子组件调用注入到父页面providee
  inject: [],
  //dom加载完
  mounted() {
  },
  //页面的自定义方法
  methods: {

  }
};
</script>

<style scoped>
</style>
