我正在使用Bootstrap v3.3.6和jQuery v2.2.4
我是否需要更改版本以免出现此错误。 我有如下的index.html
<html lang="en">
<head>
<link href="css/style.css" rel="stylesheet">
</head>
<body class="nav-md">
<div id="app"></div>
<script src="./js/jquery.min.js"></script>
<script src="./js/bootstrap.min.js"></script>
<script src="./js/custom.min.js"></script>
<script src="/bundle.js"></script>
</body>
</html>
Index.js文件
import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { Router, browserHistory } from 'react-router';
import routes from './routes';
import './css/bootstrap.min.css';
import './css/custom.min.css';
import './css/style.css';
import './js/jquery.min.js';
import './js/bootstrap.min.js';
import './js/custom.min.js';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import {indigoA200} from 'material-ui/styles/colors';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
const muiTheme = getMuiTheme({
palette: {
primary1Color: indigoA200,
primary2Color: indigoA200,
},
});
ReactDOM.render((
<MuiThemeProvider muiTheme={muiTheme}>
<Router history={browserHistory} routes={routes} />
</MuiThemeProvider>)
,document.getElementById('app')
);
我看不到用户界面,我在获取Bootstrap的JavaScript需要jQuery
答案 0 :(得分:0)
从给定的消息中,您的jQuery Bootstrap和其他文件似乎未正确设置并包含一些错误,并且javascript在单个线程上运行,因此它终止执行而未达到文件的完成状态并抛出错误。 请检查您的jQuery和Bootstrap文件,并尝试使用Getting Start with Bootstrap
中的CDN据我所知,您使用导入错误,并且如果index.html文件具有src,则无需将其导入index.js文件中,并且可以类似地使用所有类。请看 How to include third party libraries in React