ant-design/components/tree-select/demo/treeData.tsx
Jony J 8fb50a6443
feat: retire deprecated api and migrate scope (#52876)
* chore: upgrade RC component dependencies

* chore: trigger CI build

* chore: update deps and import path

* chore: update deps

* test: update snapshot

* test: update snapshot

* fix: lint fix

* chore: migrate Drawer to @rc-component/drawer

* chore: migrate Image to @rc-component/image

* test: update snapshot

* chore: replace api

* fix cascader dropdown api and snap, popupAlign

* fix ci test

* fix key

* test: update snapshot

* Revert "test: update snapshot"

This reverts commit 66a993332b.

* chore: fix logic

* test: update snapshot

* chore: revert part logic

---------

Signed-off-by: Jony J <1844749591@qq.com>
Co-authored-by: thinkasany <480968828@qq.com>
Co-authored-by: 二货机器人 <smith3816@gmail.com>
2025-02-27 21:22:09 +08:00

47 lines
822 B
TypeScript

import React, { useState } from 'react';
import { TreeSelect } from 'antd';
const treeData = [
{
title: 'Node1',
value: '0-0',
children: [
{
title: 'Child Node1',
value: '0-0-1',
},
{
title: 'Child Node2',
value: '0-0-2',
},
],
},
{
title: 'Node2',
value: '0-1',
},
];
const App: React.FC = () => {
const [value, setValue] = useState<string>();
const onChange = (newValue: string) => {
console.log(newValue);
setValue(newValue);
};
return (
<TreeSelect
style={{ width: '100%' }}
value={value}
popupStyle={{ maxHeight: 400, overflow: 'auto' }}
treeData={treeData}
placeholder="Please select"
treeDefaultExpandAll
onChange={onChange}
/>
);
};
export default App;