我正在尝试使用React、React-Router和bootstrap来定义一个基于药丸的导航栏。我这样定义导航栏:
render: function() {
return (
<div className="container-fluid">
<ul className="nav nav-pills">
<li className="active"><Link data-toggle="tab" to="/test/vocabulary">Vocabulary</Link></li>
<li><Link data-toggle="tab" to="/test/noun">Noun</Link></li>
</ul>
<div className="tab-content">
<div id="vocabulary" className="tab-pane fade in active">
<TestVocabularyView/>
</div>
<div id="noun" className="tab-pane fade">
<TestNounView/>
</div>
</div>
</div>
);
}我遇到的问题是<Link>的“数据切换”方面。当我单击pill标题时,我在浏览器控制台中看到以下内容:
jquery.js:1491 Uncaught Error: Syntax error, unrecognized expression:
#/test/nounSizzle.error @ jquery.js:1491Sizzle.tokenize @
jquery.js:2108Sizzle.select @ jquery.js:2512Sizzle @
jquery.js:888jQuery.fn.extend.find @ jquery.js:2728jQuery.fn.init @
jquery.js:2845jQuery @ jquery.js:73Tab.show @ bootstrap.js:2096(anonymous function) @ bootstrap.js:2169jQuery.extend.each @
jquery.js:384jQuery.fn.jQuery.each @ jquery.js:136Plugin @
bootstrap.js:2164clickHandler @ bootstrap.js:2193jQuery.event.dispatch @
jquery.js:4665elemData.handle @ jquery.js:4333我的路由设置如下:
<Route path="test" component={TestView}>
<Route path="vocabulary" component={TestVocabularyView}/>
<Route path="noun" component={TestNounView}/>
</Route>当我将鼠标悬停在“名词”药丸标题上时,我看到这个网址:http://localhost:3000/#/test/noun
我正在使用browserHistory。
发布于 2018-09-18 14:51:57
而不是做
<li><Link data-toggle="tab" to="/test/noun">Noun</Link></li>我这样做了:
<li data-toggle="tab"><Link to="/test/noun">Noun</Link></li>https://stackoverflow.com/questions/36120222
复制相似问题