vue组件封装-下拉框-多选框-搜索框(一)

在这里插入图片描述

<template>
  <div>
    <!-- 标签组下拉选择 -->
    <div>
      <el-popover v-model="visible" placement="bottom" width="300">
        <el-input slot="reference" v-model="group" readonly placeholder="请选择标签组" @click.native="inputFocus()" />
        <div class="total">
          <span class="head">{{ title }}{{ zongshu }}</span>
          <el-input v-model="input2" placeholder="请输入内容" suffix-icon="el-icon-search" class="input1"
            @input="change(input2)" />
         <el-checkbox-group
          v-for="(item, key) in shuju"
          :key="key"
          v-model="checkList"
          readonly
          @change="hel"
        >
          <el-checkbox :label="item" style="margin-top: 10px" class="fx-y-center">
            <div class="Employee">
              <span class="fx-1">
                {{ item.groupName }}
              </span>
            </div>
          </el-checkbox>
        </el-checkbox-group>
        </div>
      </el-popover>
    </div>
  </div>
</template>
<script>

export default {
  props: {
    title: {
      type: String,
      default: ''
    },
    shuju: {
      type: Array,
      default: () => []
    },
    zongshu: {
      type: String,
      default: '0'
    }
  },
  data() {
    return {
      visible: false,
      checked: [],
      total: 0,
      params: {
        page: 1,
        size: 30,
        departmentID: ''
      },
      group: '',
      input2: '',
      groupdata: [],
      groupdata1: [],
      checkList:[]
    }
  },

  watch: {
    visible() {
      console.log(this.visible)
    }
  
  },
  mounted() {
  },
  methods: {
    inputFocus() {
      console.log('加载数据')
    },

    hel(data){
       console.log(data)
      const a = []
      for (const i in data) {
        a[i] = data[i].ID
      }
      console.log(a)
     
      this.$emit('changehello',a)
    },

    
    change(input2) {
      this.$emit('changeInp', input2)
    }
  }
}
</script>
<style scoped lang="scss">
.head {
  display: inline-block;
}

.input1 {
  display: block;
  width: 260px;
  margin-top: 20px;
  margin-bottom: 10px;
}

.head1 {
  overflow: hidden;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  margin-top: 10px;
  margin-right: 10px;
}

.total {
  height: 380px;
  overflow: auto;
}
</style>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值