Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | 1x 1x 1x | import React, { useState } from "react"; import { CheckTree } from "@tencent/tea-component/lib/checktree"; import { Switch } from "@tencent/tea-component/lib/switch"; export default function SwitchTreeExample() { const [selected, setSelected] = useState([]); const relations = { gz: "gd", sz: "gd", fs: "gd", by: "gz", th: "gz", ns: "sz", ft: "sz", sd: "fs", cc: "fs", }; return ( <CheckTree relations={relations} value={selected} onChange={value => setSelected(value)} > <Switch name="gd">广东省</Switch> <ul style={{ paddingLeft: 20 }}> <li style={{ paddingTop: 5 }}> <Switch name="gz">广州市</Switch> <ul style={{ paddingLeft: 20 }}> <li style={{ paddingTop: 5 }}> <Switch name="by">白云区</Switch> </li> <li style={{ paddingTop: 5 }}> <Switch name="th">天河区</Switch> </li> </ul> </li> <li style={{ paddingTop: 5 }}> <Switch name="sz">深圳市</Switch> <ul style={{ paddingLeft: 20 }}> <li style={{ paddingTop: 5 }}> <Switch name="ns">南山区</Switch> </li> <li style={{ paddingTop: 5 }}> <Switch name="ft">福田区</Switch> </li> </ul> </li> <li style={{ paddingTop: 5 }}> <Switch name="fs">佛山市</Switch> <ul style={{ paddingLeft: 20 }}> <li style={{ paddingTop: 5 }}> <Switch name="sd">顺德区</Switch> </li> <li style={{ paddingTop: 5 }}> <Switch name="cc">禅城区</Switch> </li> </ul> </li> </ul> </CheckTree> ); } |