嗨,我是新手做出反应并尝试使用react-router来浏览我的应用程序 我有像我这样的css和脚本的index.html
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>My Apps</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" href="/assets/css/font-awesome.min.css">
<link rel="stylesheet" href="/assets/css/bootstrap.min.css">
<link rel="stylesheet" href="/assets/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="/assets/css/angular-material.min.css">
<link id="app_main_css" rel="stylesheet" href="/assets/css/main.css">
<script src="/assets/js/jquery.min.js"></script>
</head>
<body data-ng-app="app" id="app" data-custom-background="" data-off-canvas-nav="" data-ng-controller="MyController">
<div id="root"></div>
<script id="app_js" type="text/javascript" src="/assets/js/app.js"></script>
</body>
我的路线看起来像这样
ReactDOM.render(
<Router history={browserHistory}>
<Route path='/' component={MasterPage}>
<IndexRoute component={Dashboard} />
<Route path='/dashboard' component={Dashboard} />
<Route path='/dashboard1' component={Dashboard1} />
</Route>
</Router>,
document.getElementById('root')
);
当第一次加载css并且脚本运行良好时,我的仪表板按预期显示,但当我导航到让Dashboard1说css和脚本不会加载时,然后当我导航回Dashboard时它也没有加载。 所以css和脚本只是第一次加载。 如何使嵌套子页面也加载主css?