mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 02:59:04 +08:00
docs: clean up cacader loading demo (#42682)
This commit is contained in:
parent
e6a883c592
commit
755598f839
@ -1,12 +1,11 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Cascader } from 'antd';
|
||||
import React, { useState } from 'react';
|
||||
|
||||
interface Option {
|
||||
value?: string | number | null;
|
||||
label: React.ReactNode;
|
||||
children?: Option[];
|
||||
isLeaf?: boolean;
|
||||
loading?: boolean;
|
||||
}
|
||||
|
||||
const optionLists: Option[] = [
|
||||
@ -31,11 +30,9 @@ const App: React.FC = () => {
|
||||
|
||||
const loadData = (selectedOptions: Option[]) => {
|
||||
const targetOption = selectedOptions[selectedOptions.length - 1];
|
||||
targetOption.loading = true;
|
||||
|
||||
// load options lazily
|
||||
setTimeout(() => {
|
||||
targetOption.loading = false;
|
||||
targetOption.children = [
|
||||
{
|
||||
label: `${targetOption.label} Dynamic 1`,
|
||||
|
Loading…
Reference in New Issue
Block a user