9

有谁知道如何删除<Menu><Dropdown>...组件上的插入符号?

据我所知,该组件的道具列表没有标志。这个事情谁有经验?

import React from 'react'
import { Dropdown, Menu } from 'semantic-ui-react'
import { Menu as MenuIcon } from 'react-feather'

// this automatically renders a right-hand caret on the menu
// I added my own icon 'MenuIcon' from the feather icon set 
// and i want to get rid of the caret
const Header = () => (
  <Menu vertical compact>
    <Dropdown item text={<MenuIcon/>}>
      <Dropdown.Menu>
        <Dropdown.Item>Electronics</Dropdown.Item>
        <Dropdown.Item>Automotive</Dropdown.Item>
        <Dropdown.Item>Home</Dropdown.Item>
      </Dropdown.Menu>
    </Dropdown>
  </Menu>
)

export default Header

4

1 回答 1

16

Dropdown组件实现了icon 简写,因此您可以使用以下内容:

 <Dropdown icon={null} /> // will render nothing
 <Dropdown icon='remove' /> // will render 'remove' icon
 <Dropdown icon={{ name: 'remove', onClick: () => console.log('iconClick') /> // will render 'remove' icon and add event hanlder
 <Dropdown icon={<Icon name='remove' />} /> // will render 'Icon' component
于 2017-08-27T11:21:36.060 回答