【发布时间】:2017-12-13 17:44:17
【问题描述】:
我正在尝试将汉堡菜单添加到我的侧边栏。
我正在使用引导侧边栏 - 版本 3.3.7,并且我的 bootstrap.min.css 已复制到我的文件夹:
<link rel="stylesheet" type="text/css" href="/bower_components/bootstrap/dist/css/bootstrap.min.css"/>
编码:
const contentHeader = (
<span>
<a href="#" onClick={this.menuButtonClick}>
<span class="glyphicon glyphicon-menu-hamburger">=</span>
</a>
<span> My Site - {this.state.selected}</span>
</span>);
当我运行网站时,我看不到图标,我尝试调试网站
我看到这个元素是空的,当我编辑元素并添加 class="glyphicon glyphicon-menu-hamburger" 时,汉堡图标出现了。
image of the debug of the element
如何让图标一直出现?
【问题讨论】:
-
请提供代码
-
contentHeader是不是类似于 JSX?如果是这样,我认为您必须使用className而不是class,因为class是JavaScript 中的保留字,例如<span className="glyphicon glyphicon-menu-hamburger">=</span> -
谢谢!我将课程更改为课程名称并且它有效!
标签: javascript html css twitter-bootstrap sidebar