Browse Source

docs: clean up cacader loading demo (#42682)

pull/42689/head
二货爱吃白萝卜 2 years ago
committed by GitHub
parent
commit
755598f839
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      components/cascader/demo/lazy.tsx

5
components/cascader/demo/lazy.tsx

@ -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…
Cancel
Save