语义 ui 下拉菜单在 React 中不起作用?
Semantic ui dropdown menu not working in react?
我最近学习了语义-ui,一切都很顺利,直到出现下拉菜单。这是代码:
render() {
return (<div className="ui form">
<div className="field">
<div className="ui selection dropdown">
<input type="hidden" name="options"/>
<i className="dropdown icon"></i>
<div className="default text">Options</div>
<div className="menu">
<div className="item">Option 1</div>
<div className="item">Option 2</div>
</div>
</div>
</div>
</div>);
}
我没有使用任何css,也没有使用库,除了反应和语义-ui,它只是显示一个无法点击的下拉菜单,知道吗?
来自Semantic UI docs :
Any select element initialized as dropdown will also be hidden until Javascript can create HTML, this is to avoid the flash of unstyled content, and the change in element height adjusting page flow.
您必须添加以下内容javascript 才能使您的下拉菜单正常工作
$('.ui.dropdown').dropdown();
我最近学习了语义-ui,一切都很顺利,直到出现下拉菜单。这是代码:
render() {
return (<div className="ui form">
<div className="field">
<div className="ui selection dropdown">
<input type="hidden" name="options"/>
<i className="dropdown icon"></i>
<div className="default text">Options</div>
<div className="menu">
<div className="item">Option 1</div>
<div className="item">Option 2</div>
</div>
</div>
</div>
</div>);
}
我没有使用任何css,也没有使用库,除了反应和语义-ui,它只是显示一个无法点击的下拉菜单,知道吗?
来自Semantic UI docs :
Any select element initialized as dropdown will also be hidden until Javascript can create HTML, this is to avoid the flash of unstyled content, and the change in element height adjusting page flow.
您必须添加以下内容javascript 才能使您的下拉菜单正常工作
$('.ui.dropdown').dropdown();