<!--
 * @Descripttion:
 * @Version: 1.0
 * @Author: lr
 * @Date: 2022-02-18 08:56:43
 * @LastEditors: wufz
 * @LastEditTime: 2023-01-09 17:18:34
-->
<template>
  <vxe-checkbox-group v-if="!isDetail" v-bind="$attrs" v-on="$listeners">
    <slot></slot>
  </vxe-checkbox-group>
  <span v-else>{{ formVal }} </span>
</template>

<script>
import formComponents from "./formComponents"
export default {
  name: 'DxxCheckboxGroup',
  //页面引用的组件
  components: {},
  //继承表单父组件
  extends: formComponents,
  //父页面传递参数
  props: {},
  data() {
    return {};
  },
  //监控计算变量
  computed: {
    // 计算属性的
    formVal: function () {
      //找出checkbox对应的value项
      var a = []
      this.$slots.default.filter((item1) => {
        this.$attrs.value.filter((item2) => {
          if (item1.data.attrs.label == item2) {
            a.push(item1.data.attrs.content)
          }
        })
      })
      let radioVal = a.length > 0 ? a.join(' ') : ''
      return radioVal

    }
  },
  //监听
  watch: {},
  //页面的构造方法
  created() { },
  //父页面定义方法给子页面inject调用
  providee() { return {} },
  //子组件调用注入到父页面providee
  inject: [],
  //dom加载完
  mounted() {
  },
  //页面的自定义方法
  methods: {

  }
};
</script>

<style scoped>
</style>
