import './demo6.css'; import Checkbox from '../../checkbox'; import Menu from '..'; import Radio from '../../radio'; import React from 'react'; import ReactDOM from 'react-dom'; const { SubMenu, Item } = Menu; interface PageStates{ isSelectIconRight:boolean; selectMode:string; selectedKeys:Array; multiple:boolean; } class Demo extends React.Component <{}, PageStates> { handleIconDirectionChange: () => void; onSelectModeChange: (selectMode: any) => void; handleSelect: (selectedKeys: any, ...others: any[]) => void; constructor(props) { super(props); this.handleIconDirectionChange = () => { this.setState({ isSelectIconRight: !this.state.isSelectIconRight, }); }; this.onSelectModeChange = selectMode => { console.log(selectMode, '======='); this.setState({ selectMode, }); }; this.handleSelect = (selectedKeys, ...others) => { this.setState({ selectedKeys, }); console.log(selectedKeys, ...others); }; this.state = { selectMode: undefined, multiple: false, isSelectIconRight: false, selectedKeys: [ '1' ], }; } render() { const { selectMode, selectedKeys, isSelectIconRight } = this.state; return (
单选带符号 单选不带符号(默认) 多选
{selectMode ? ( 切换标记位置 (默认在左) ) : null}
Option 1 Disabled option 2 Sub option 1 Sub option 2 Option 3
); } } ReactDOM.render( , document.getElementById('menu-demo-6'), );