返回stmt后无法访问的代码

时间:2016-05-14 22:05:21

标签: reactjs

我有以下示例代码,我得到 - “返回stmt后无法访问的代码”..

removed https:// from first and second line

HTML

<!DOCTYPE html>
<html>
<head>
    <script src="fb.me/react-0.13.3.min.js"></script>
    <script src=":cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.29/browser.js"></script>

    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

    <!-- Optional theme -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">

    <!-- Latest compiled and minified JavaScript -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
    <title>React Components</title>
</head>

<body>
    <div id="react-container"></div>
    <script type="text/babel" src="./createpanel.js">
    <script type="text/babel" src="./filterpanel.js">
    <script type="text/babel" src="./myscript.js">
    </script>
</body>

</html>

createpanel.js

var CreatePanel = React.createClass({ 
    render: function(){ 
        return <div className="row">
            <div className = "col-xs-6 col-sm-3">
                <input type="text"></input>
                <select></select>
            </div>
        </div>; 
    } 
}); 

myscript.js

React.render(<div class="container">
    <CreatePanel/>   
    <FilterPanel/> 
</div>
    , document.getElementById('react-container'));

filterpanel.js

var FilterPanel = React.createClass({ 
    render: function(){ 
        return <div className="row">Filter Panel</div>; 
    } 
}); 

1 个答案:

答案 0 :(得分:1)

我认为缺少结束script标签可能就是原因。尝试:

<script type="text/babel" src="./createpanel.js"></script>
<script type="text/babel" src="./filterpanel.js"></script>
<script type="text/babel" src="./myscript.js"></script>