import{e as i,o as h,b as u,g as f,l as e,F as t,H as x,B as N,C as $,a as v,G as b,D as y,X as w}from"./@vue.e84e1286.js";import{_ as K}from"./index.c8cfbd6c.js";import{p as m}from"./preview.2bfe2f00.js";import"./vue-router.54876e93.js";import"./bus.f1893518.js";import"./mitt.550594b0.js";/* empty css */const S={__name:"demo1",setup(n){const d=[{label:"\u4E00\u7EA7 1",children:[{label:"\u4E8C\u7EA7 1-1",children:[{label:"\u4E09\u7EA7 1-1-1"}]}]},{label:"\u4E00\u7EA7 2",children:[{label:"\u4E8C\u7EA7 2-1",children:[{label:"\u4E09\u7EA7 2-1-1"}]},{label:"\u4E8C\u7EA7 2-2"}]},{label:"\u4E00\u7EA7 3",children:[{label:"\u4E8C\u7EA7 3-1",children:[{label:"\u4E09\u7EA7 3-1-1"}]},{label:"\u4E8C\u7EA7 3-2",children:[{label:"\u4E09\u7EA7 3-2-1"}]}]}];return(s,c)=>{const a=i("m-tree");return h(),u(a,{data:d})}}},B={__name:"demo2",setup(n){const d=[{name:"\u4E00\u7EA7 1",children:[{name:"\u4E8C\u7EA7 1-1",children:[{name:"\u4E09\u7EA7 1-1-1"},{name:"\u4E09\u7EA7 1-1-2"}]},{name:"\u4E8C\u7EA7 1-2"}]},{name:"\u4E00\u7EA7 2",children:[{name:"\u4E8C\u7EA7 2-1",children:[{name:"\u4E09\u7EA7 2-1-1"}]},{name:"\u4E8C\u7EA7 2-2"}]},{name:"\u4E00\u7EA7 3",children:[{name:"\u4E8C\u7EA7 3-1"},{name:"\u4E8C\u7EA7 3-2"}]}];return(s,c)=>{const a=i("m-tree");return h(),u(a,{data:d,label:"name",children:"children","show-checkbox":""})}}};const g=n=>(N("data-v-277b83a8"),n=n(),$(),n),F=g(()=>e("p",{class:"title"},"\u81EA\u5B9A\u4E49\u5C55\u5F00\u548C\u9009\u4E2D",-1)),I={class:"mt-50"},V=g(()=>e("p",{class:"title"},"\u5C55\u5F00\u6240\u6709\u9879",-1)),O={__name:"demo3",setup(n){const d=[{id:1,label:"\u4E00\u7EA7 1",children:[{id:4,label:"\u4E8C\u7EA7 1-1",children:[{id:10,label:"\u4E09\u7EA7 1-1-1"},{id:11,label:"\u4E09\u7EA7 1-1-2"}]},{id:5,label:"\u4E8C\u7EA7 1-2"}]},{id:2,label:"\u4E00\u7EA7 2",children:[{id:6,label:"\u4E8C\u7EA7 2-1"},{id:7,label:"\u4E8C\u7EA7 2-2"}]},{id:3,label:"\u4E00\u7EA7 3",children:[{id:8,label:"\u4E8C\u7EA7 3-1"},{id:9,label:"\u4E8C\u7EA7 3-2"}]}];return(s,c)=>{const a=i("m-tree");return h(),f(x,null,[e("div",null,[F,t(a,{data:d,"node-key":"id","show-checkbox":"","default-expanded-keys":[1,4],"default-checked-keys":[4]})]),e("div",I,[V,t(a,{data:d,"node-key":"id","show-checkbox":"","default-expand-all":""})])],64)}}};var T=K(O,[["__scopeId","data-v-277b83a8"]]);const E={__name:"demo4",setup(n){const d=[{id:1,label:"\u4E00\u7EA7 1",children:[{id:4,label:"\u4E8C\u7EA7 1-1",children:[{id:10,label:"\u4E09\u7EA7 1-1-1"},{id:11,label:"\u4E09\u7EA7 1-1-2"}]},{id:5,label:"\u4E8C\u7EA7 1-2"}]},{id:2,label:"\u4E00\u7EA7 2",disabled:!0,children:[{id:6,label:"\u4E8C\u7EA7 2-1",disabled:!0,children:[{id:12,label:"\u4E09\u7EA7 2-1-1",disabled:!0}]},{id:7,label:"\u4E8C\u7EA7 2-2"}]},{id:3,label:"\u4E00\u7EA7 3",children:[{id:8,label:"\u4E8C\u7EA7 3-1"},{id:9,label:"\u4E8C\u7EA7 3-2"}]}];return(s,c)=>{const a=i("m-tree");return h(),u(a,{data:d,"node-key":"id","show-checkbox":"","default-expanded-keys":[1,2,6],"default-checked-keys":[2]})}}},J=y("\u901A\u8FC7node-key\u8BBE\u7F6E\u9009\u4E2D"),P=y("\u83B7\u53D6\u9009\u4E2D\u9879\u7684\u6570\u636E\u6570\u7EC4"),R=y("\u83B7\u53D6\u9009\u4E2D\u9879\u7684keys\u6570\u7EC4"),z=y("\u6E05\u7A7A\u9009\u4E2D\u9879"),A={__name:"demo5",setup(n){const d=v(null),s=[{id:1,label:"\u4E00\u7EA7 1",children:[{id:4,label:"\u4E8C\u7EA7 1-1",children:[{id:10,label:"\u4E09\u7EA7 1-1-1"},{id:11,label:"\u4E09\u7EA7 1-1-2"}]},{id:5,label:"\u4E8C\u7EA7 1-2"}]},{id:2,label:"\u4E00\u7EA7 2",children:[{id:6,label:"\u4E8C\u7EA7 2-1",children:[{id:12,label:"\u4E09\u7EA7 2-1-1"}]},{id:7,label:"\u4E8C\u7EA7 2-2"}]},{id:3,label:"\u4E00\u7EA7 3",children:[{id:8,label:"\u4E8C\u7EA7 3-1"},{id:9,label:"\u4E8C\u7EA7 3-2"}]}],c=()=>{d.value.setCheckedKeys([4])},a=()=>{const l=d.value.getCheckedNodes();alert(JSON.stringify(l)),console.log(l)},k=()=>{const l=d.value.getCheckedKeys();alert(JSON.stringify(l)),console.log(l)},o=()=>{d.value.setCheckedKeys([])};return(l,_)=>{const r=i("m-tree"),p=i("m-button"),C=i("m-space");return h(),f(x,null,[t(r,{ref_key:"treeRef",ref:d,data:s,"node-key":"id","show-checkbox":"","default-expand-all":"",style:{"margin-bottom":"20px"}},null,512),t(C,null,{default:b(()=>[t(p,{type:"primary",onClick:c},{default:b(()=>[J]),_:1}),t(p,{type:"primary",onClick:a},{default:b(()=>[P]),_:1}),t(p,{type:"primary",onClick:k},{default:b(()=>[R]),_:1}),t(p,{type:"primary",onClick:o},{default:b(()=>[z]),_:1})]),_:1})],64)}}};const D={__name:"demo6",setup(n){let d=1e3;const s=v([{id:1,label:"\u4E00\u7EA7 1",children:[{id:4,label:"\u4E8C\u7EA7 1-1",children:[{id:10,label:"\u4E09\u7EA7 1-1-1"},{id:11,label:"\u4E09\u7EA7 1-1-2"}]},{id:5,label:"\u4E8C\u7EA7 1-2"}]},{id:2,label:"\u4E00\u7EA7 2",children:[{id:6,label:"\u4E8C\u7EA7 2-1",children:[{id:12,label:"\u4E09\u7EA7 2-1-1"}]},{id:7,label:"\u4E8C\u7EA7 2-2"}]},{id:3,label:"\u4E00\u7EA7 3",children:[{id:8,label:"\u4E8C\u7EA7 3-1"},{id:9,label:"\u4E8C\u7EA7 3-2"}]}]),c=(o,{data:l,parentData:_})=>o("div",{class:"custom-tree__item"},[o("span",{class:"custom-tree__label"},l.label),o("div",{style:{color:"#409eff",fontSize:"14px"}},[o("span",{style:{margin:"0 10px"},onClick:r=>a(l,r)},"\u8FFD\u52A0"),o("span",{onClick:r=>k(l,_,r)},"\u5220\u9664")])]),a=(o,l)=>{l.stopPropagation(),(o.children||[]).push({id:d++,label:"children-node"}),s.value=[...s.value]},k=(o,l,_)=>{_.stopPropagation();const r=l.indexOf(o);r>-1&&l.splice(r,1)};return(o,l)=>{const _=i("m-tree");return h(),u(_,{data:s.value,"node-key":"id","show-checkbox":"","default-expand-all":"","render-content":c},null,8,["data"])}}},G={class:"markdown-body"},H=e("h1",null,"Tree \u6811\u5F62\u63A7\u4EF6",-1),M=e("h4",null,"\u7528\u6E05\u6670\u7684\u5C42\u7EA7\u7ED3\u6784\u5C55\u793A\u4FE1\u606F\uFF0C\u53EF\u5C55\u5F00\u6216\u6298\u53E0\u3002",-1),X=e("br",null,null,-1),j=e("h2",null,"\u57FA\u7840\u7528\u6CD5",-1),q=e("h4",null,"\u57FA\u7840\u7684\u6811\u5F62\u7ED3\u6784\u5C55\u793A\u3002",-1),L={class:"source"},Q=e("h2",null,"\u53EF\u9009\u62E9",-1),U=e("h4",null,"\u9002\u7528\u4E8E\u9700\u8981\u9009\u62E9\u5C42\u7EA7\u65F6\u4F7F\u7528\u3002\u8BBE\u7F6Eshow-checkbox \u5C5E\u6027\u4E3Atrue\u3002\u5E76\u4E14\u53EF\u81EA\u5B9A\u4E49\u6570\u636E\u7ED3\u6784\u7684\u952E\u540D\uFF0C\u9ED8\u8BA4\u4E3Alabel \u548C children",-1),W={class:"source"},Y=e("h2",null,"\u9ED8\u8BA4\u5C55\u5F00\u548C\u9009\u4E2D",-1),Z=e("h4",null,"\u652F\u6301\u9ED8\u8BA4\u5C55\u5F00\u548C\u9009\u4E2D\uFF0C\u4F46\u662F\u5FC5\u987B\u8981\u8BBE\u7F6Enode-key\u5C5E\u6027\u3002 \u652F\u6301\u9ED8\u8BA4\u5C55\u5F00\u6240\u6709\u9009\u9879",-1),ee={class:"source"},te=e("h2",null,"\u7981\u7528\u72B6\u6001",-1),de=e("h4",null,"\u901A\u8FC7 disabled \u5C5E\u6027\uFF0C\u53EF\u5C06 Tree \u7684\u67D0\u4E9B\u8282\u70B9\u8BBE\u7F6E\u4E3A\u7981\u7528\u72B6\u6001\u3002",-1),le={class:"source"},ae=e("h2",null,"\u6811\u8282\u70B9\u7684\u8BBE\u7F6E\u548C\u83B7\u53D6",-1),oe={class:"source"},ne=e("h2",null,"\u81EA\u5B9A\u4E49\u8282\u70B9\u5185\u5BB9",-1),se=e("h4",null,"\u8282\u70B9\u7684\u5185\u5BB9\u652F\u6301\u81EA\u5B9A\u4E49\uFF0C\u53EF\u4EE5\u5728\u8282\u70B9\u533A\u6DFB\u52A0\u6309\u94AE\u6216\u56FE\u6807\u7B49\u5185\u5BB9\u3002",-1),ce={class:"source"},re=w("

Attributes

\u53C2\u6570\u8BF4\u660E\u7C7B\u578B\u53EF\u9009\u503C\u9ED8\u8BA4\u503C
data\u5C55\u793A\u6570\u636Earray\u2014\u2014
label\u5B9A\u4E49\u5B50\u8282\u70B9\u540D\u79F0\u5728data\u6570\u636E\u5BF9\u8C61\u4E2D\u7684\u952E\u540Dstring\u2014label
children\u5B9A\u4E49\u5B50\u8282\u70B9\u6570\u636E\u5728data\u6570\u636E\u5BF9\u8C61\u4E2D\u7684\u952E\u540Dstring\u2014children
show-checkbox\u8282\u70B9\u662F\u5426\u53EF\u88AB\u9009\u62E9boolean\u2014false
node-key\u6BCF\u4E2A\u6811\u8282\u70B9\u7528\u6765\u4F5C\u4E3A\u552F\u4E00\u6807\u8BC6\u7684\u5C5E\u6027\uFF0C\u6574\u68F5\u6811\u5E94\u8BE5\u662F\u552F\u4E00\u7684string\u2014\u2014
default-expand-all\u662F\u5426\u9ED8\u8BA4\u5C55\u5F00\u6240\u6709\u8282\u70B9boolean\u2014false
default-expanded-keys\u9ED8\u8BA4\u7684\u5C55\u5F00\u9879array\u2014\u2014
default-checked-keys\u9ED8\u8BA4\u7684\u9009\u4E2D\u9879array\u2014\u2014
disabled\u662F\u5426\u7981\u7528boolean\u2014false
render-content\u81EA\u5B9A\u4E49\u6811\u8282\u70B9\u7684\u5185\u5BB9\u533A\u7684\u6E32\u67D3 FunctionFunction(h, { data, parentData })\u2014\u2014

Events

\u4E8B\u4EF6\u540D\u8BF4\u660E\u56DE\u8C03\u51FD\u6570\u53C2\u6570
toggle-change\u5C55\u5F00/\u6536\u8D77\u5B50\u8282\u70B9\u65F6\u89E6\u53D1\u5F53\u524D\u8282\u70B9
checked-change\u8282\u70B9\u9009\u4E2D/\u53D6\u6D88\u65F6\u89E6\u53D1\u6240\u6709\u9009\u4E2D\u8282\u70B9\u7684\u6570\u7EC4\u3001\u5F53\u524D\u8282\u70B9\u6570\u636E

Methods

\u65B9\u6CD5\u540D\u8BF4\u660E\u53C2\u6570
setCheckedKeys\u901A\u8FC7key\u8BBE\u7F6E\u9009\u4E2D\u7684\u8282\u70B9key\u6570\u7EC4
getCheckedKeys\u8FD4\u56DE\u6240\u6709\u9009\u4E2D\u8282\u70B9\u7684key\u7EC4\u6210\u7684\u6570\u7EC4-
getCheckedNodes\u8FD4\u56DE\u6240\u6709\u9009\u4E2D\u8282\u70B9\u7684\u6570\u636E\u7EC4\u6210\u7684\u6570\u7EC4-
",9),ye={__name:"doc",setup(n,{expose:d}){return d({frontmatter:{}}),(c,a)=>(h(),f("div",G,[H,M,X,j,q,e("div",L,[t(S)]),t(m,{compName:"tree",demoName:"demo1"}),Q,U,e("div",W,[t(B)]),t(m,{compName:"tree",demoName:"demo2"}),Y,Z,e("div",ee,[t(T)]),t(m,{compName:"tree",demoName:"demo3"}),te,de,e("div",le,[t(E)]),t(m,{compName:"tree",demoName:"demo4"}),ae,e("div",oe,[t(A)]),t(m,{compName:"tree",demoName:"demo5"}),ne,se,e("div",ce,[t(D)]),t(m,{compName:"tree",demoName:"demo6"}),re]))}};export{ye as default};