Skip to content

DCheckFilter 条件筛选

用于条件筛选。

基础用法

标题一 :
标题二 :
Show Code
vue
<template>
  <div v-for="item in list">
    <d-check-filter :checkList="item.children" :title="item.title" @sendCheck="sendCheck" />
  </div>
  <d-tags :tagsList="tagsList" tageTitle="选中" />
</template>
<script setup lang="ts">
import { DCheckFilter,DTags } from 'dc-pro-component';
import { ref } from "vue";
const list = ref([
  {
    title: "标题一",
    children: [
      {value:'1-1',label:'标题 1-1'},
      {value:'1-2',label:'标题 1-2'},
      {value:'1-3',label:'标题 1-3'},
      {value:'1-4',label:'标题 1-4'},
    ],
  },
  {
    title: "标题二",
    children: [
      {value:'2-1',label:'标题 2-1'},
      {value:'2-2',label:'标题 2-2'},
      {value:'2-3',label:'标题 2-3'},
    ],
  },
]);
const tagsList = ref([])
const sendCheck = (currentList:any,checkTags:any[]) => {
  console.log(currentList,'当前标题选中的数据');
  console.log(checkTags,'所有选中的数据');
  tagsList.value = checkTags
}
</script>
<template>
  <div v-for="item in list">
    <d-check-filter :checkList="item.children" :title="item.title" @sendCheck="sendCheck" />
  </div>
  <d-tags :tagsList="tagsList" tageTitle="选中" />
</template>
<script setup lang="ts">
import { DCheckFilter,DTags } from 'dc-pro-component';
import { ref } from "vue";
const list = ref([
  {
    title: "标题一",
    children: [
      {value:'1-1',label:'标题 1-1'},
      {value:'1-2',label:'标题 1-2'},
      {value:'1-3',label:'标题 1-3'},
      {value:'1-4',label:'标题 1-4'},
    ],
  },
  {
    title: "标题二",
    children: [
      {value:'2-1',label:'标题 2-1'},
      {value:'2-2',label:'标题 2-2'},
      {value:'2-3',label:'标题 2-3'},
    ],
  },
]);
const tagsList = ref([])
const sendCheck = (currentList:any,checkTags:any[]) => {
  console.log(currentList,'当前标题选中的数据');
  console.log(checkTags,'所有选中的数据');
  tagsList.value = checkTags
}
</script>

Attributes

参数说明类型可选值默认值
checkList数据Array[]
title数据标题string""
labelWidhtlabel宽度number80
border是否带边框booleantrue / falsefalse
tagsListtags数据Array[]
tageTitletags标题string"标签"
closable是否可以关闭booleantrue / falsefalse

事件

事件名说明类型可选值默认值
sendCheck返回选中数据和tags数据Function(currentList:any,checkTags:any[])----

Released under the MIT License.