tuns-mobile-components
Version:
Tuns Design UI
97 lines (94 loc) • 2.1 kB
JavaScript
import React from "react";
import Tree from "../../../components/mobile/src/tree";
const TreeDemo = () => {
return (
<div style={{ padding: "30px" }}>
<h2>Tree Demo</h2>
<Tree
defaultValue="reg1"
onChange={val => {
console.log(val);
}}
radio
data={[
{
id: "1",
title: "保险条例1",
value: "reg1",
children: [
{
id: "11",
title: "保险条例1",
value: "reg311",
},
{
id: "12",
title: "保险条例2",
value: "reg12",
},
],
},
{
id: "2",
title: "保险条例2",
value: "reg2",
},
{
id: "3",
title: "保险条例3",
value: "reg3",
children: [
{
id: "31",
title: "保险条例1",
value: "reg31",
},
{
id: "32",
title: "保险条例2",
value: "reg32",
},
],
},
]}
/>
<hr />
<Tree
defaultValue="reg1"
onChange={val => {
console.log(val);
}}
data={[
{
id: "1",
title: "保险条例1",
value: "reg1",
},
{
id: "2",
title: "保险条例2",
value: "reg2",
},
{
id: "3",
title: "保险条例3",
value: "reg3",
children: [
{
id: "31",
title: "保险条例1",
value: "reg31",
},
{
id: "32",
title: "保险条例2",
value: "reg32",
},
],
},
]}
/>
</div>
);
};
export default TreeDemo;