1. 效果圖
2. 實現: 三級(部門或人員的樹形選擇)
3. 模擬數據說明: fake.js
name: 顯示的名稱(同時也是源碼中 for 循環單一的key , 如果真實數據存在名字有重復的情況, 建議加入ID字段作為主鍵)
type: department 為部門 human 為個人
children: 數據類型必須為 數組, type 為 human 個人時, 值為空數組 [], 為department 部門時 值為對象 或者為空數組
以上4個鍵為必須, 最多三級嵌套
4. 源碼 https://github.com/IceGogh/vue-components
5. 直接引入時, 將父組件的真實數據 通過props方式 傳入 organization組件
5.1.文件位置:
components/OrganizationTree
5.2. 引入
import Organ from "@/components/OrganizationTree"
5.3.調用
<organization-tree dataList:"dataArray"></organization-tree>