React bootstrap不起作用

时间:2017-08-03 15:38:35

标签: react-bootstrap

我在reactJS中使用bootstrap时遇到问题。我使用npm安装了bootstrap,并在public.html中包含了bootstrap css,但是我只能得到一个没有任何样式的按钮。 public.html:

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="theme-color" content="#000000">
    <link rel="manifest" href="%PUBLIC_URL%/manifest.json">
    <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
    <link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap-theme.min.css">
    <title>React App</title>
  </head>
  <body>
    <div id="root"></div>
    <script src="/js/bundle.js"></script>

  </body>
</html>

APP.js:

import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';

import{Button} from 'react-bootstrap';

class App extends Component {
  render() {
    return (
      <div className="App">
        <div className="App-header">
          <img src={logo} className="App-logo" alt="logo" />
          <h2>Welcome to React</h2>
        </div>
        <p className="App-intro">
          To get started, edit <code>src/App.js</code> and save to reload.
        </p>
            <button bsSize="large" bsStyle="danger">Test</button>

      </div>
    );
  }
}

export default App;

感谢您的想法!

1 个答案:

答案 0 :(得分:0)

尝试更改

//crate headers
$headers[] = "ID";
$headers[] = "Name";
$headers[] = "Ref";
$headers[] = "Quantity";

// crete and open file  
$csvName = "file.csv";
$fileHandle = fopen($csvName, 'w') or die('Can\'t create .csv file, try again later.');

//Add the headers, if I take this line out the excel allows me to open the file
fputcsv($fileHandle,$headers,";");

//Add the data
for($i = 0; $i < count($info); ++$i) {
    fputcsv($fileHandle,$info[$i],";");
}

//close file
fclose($fileHandle);

<button bsSize="large" bsStyle="danger">Test</button>

参考:http://getbootstrap.com/css/#buttons

顺便说一句,我注意到你已经安装并链接了bootstrap的本地副本以及CDN。 CDN版本显示最后一个,因此优先。