我收到了这个错误:
Warning: A path must be pathname + search + hash only, not a full URL like "http://www.shadyab.com/category/tehran/fast_food"
<li className="hidden-xs hvr-shutter-out-vertical">
<Link to={serverConstants.DOMAIN_URL + 'category/tehran/fast_food'} >فست فود</Link>
</li>
我的常量文件。
export const serverConstants = {
DOMAIN_URL: "http://www.shadyab.com/",
}
如果我删除serverConstants.DOMAIN_URL
,我的网址会附加到当前网址。
例如:
当前网址:
http://localhost:3000/category/tehran/foreign_restaurant
现在,如果我点击以下链接:
<Link to={'category/tehran/fast_food'} >فست فود</Link>
我的网址如下所示:
http://localhost:3000/category/tehran/category/tehran/fast_food
我的路线:
<Route path="/category/:city/:category" component={Category} />
我的路由器版本:
"react-router": "^3.0.5",
答案 0 :(得分:2)
使用<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<html>
<button type="button" id="btn_nav_register"> b1</button>
<button type="button" id="btn_nav_manage"> b2</button>
<div id="content">
</div>
<div id="manage" style="display:none;">
original content
</div>
<div id="register" style="display:none;">
second content
</div>
<script>
$(document).ready(function(){
$('#btn_nav_manage').trigger('click');
// auto click button when page is ready for to show default content!
// or also you can add a name for click function and call it in here
});
</script>
</html>
,您无需指定域名,只需指定路径路径,如
Link