# ByTreeSearch 树查找组件

快捷查找,定位

# 基础用法

<template>
  <by-tree-search :treeData="treeData" ref="treeSearch"></by-tree-search>
</template>

<script>
import { TreeSearch } from '@weitutech/by-components'

export default {
  data() {
    return {
      treeData: [
        {
          name: '1',
          id: 1,
          children: [
            {
              name: '1-1',
              id: 3
            }
          ]
        },
        {
          name: '2',
          id: 2,
          children: [
            {
              name: '2-1'
            },
            {
              name: '2-2'
            }
          ]
        }
      ]
    }
  },
  methods: {
    setCheckedKeys() {
      this.$refs.tree.setCheckedKeys([1, 2])
    },
    getCheckedKeys() {
      this.checkData = JSON.stringify(this.$refs.tree.getCheckedKeys())
    }
  }
}
</script>

# Props

参数 说明 类型 默认值
treeData 树的数据 Array []
placeholder 输入框默认说明 String '请输入'
nodeKey 树的节点的唯一标识 String 'id'
showCheckbox 多选框展示 boolean true
size 尺寸大小 String 'mini'
defaultProps 树的默认配置 Object {}
最后更新时间: 8/23/2025, 3:00:21 PM