docs: update demo (#46006)

This commit is contained in:
二货爱吃白萝卜 2023-11-22 14:07:48 +08:00 committed by GitHub
parent 0cb771da20
commit e5a69664c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
import React, { useState } from 'react';
import { DownOutlined } from '@ant-design/icons';
import type { MenuProps } from 'antd';
import type { DropdownProps, MenuProps } from 'antd';
import { Dropdown, Space } from 'antd';
const App: React.FC = () => {
@ -12,8 +12,10 @@ const App: React.FC = () => {
}
};
const handleOpenChange = (flag: boolean) => {
setOpen(flag);
const handleOpenChange: DropdownProps['onOpenChange'] = (nextOpen, info) => {
if (info.source === 'trigger' || nextOpen) {
setOpen(nextOpen);
}
};
const items: MenuProps['items'] = [