docs: clean up cacader loading demo (#42682)

This commit is contained in:
二货爱吃白萝卜 2023-05-28 11:27:40 +08:00 committed by GitHub
parent e6a883c592
commit 755598f839
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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`,