在laravel + ReactJs Project中

时间:2018-06-25 19:08:15

标签: javascript php reactjs laravel-5

我想将模板集成到使用ReactJS的新的laravel项目中,但是在尝试将该模板放入不同的布局时遇到了问题。 home.blade.php返回一个空白页面,其中“边栏和标题”菜单不显示任何内容。这些是我的页面:

home.blade.php

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Bootstrap Dashboard by Bootstrapious.com</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="robots" content="all,follow">
    <!-- Bootstrap CSS-->
    <link rel="stylesheet" href="{{asset('vendor/bootstrap/css/bootstrap.min.css')}}">
    <!-- Font Awesome CSS-->
    <link rel="stylesheet" href="{{asset('vendor/font-awesome/css/font-awesome.min.css')}}">
    <!-- Fontastic Custom icon font-->
    <link rel="stylesheet" href="{{asset('css/fontastic.css')}}">
    <!-- Google fonts - Roboto -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700">
    <!-- jQuery Circle-->
    <link rel="stylesheet" href="{{asset('css/grasp_mobile_progress_circle-1.0.0.min.css')}}">
    <!-- Custom Scrollbar-->
    <link rel="stylesheet" href="{{asset('vendor/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.css')}}">
    <!-- theme stylesheet-->
    <link rel="stylesheet" href="{{asset('css/style.default.css')}}" id="theme-stylesheet">
    <!-- Custom stylesheet - for your changes-->
    <link rel="stylesheet" href="{{asset('css/custom.css')}}">
    <!-- Favicon-->
    <link rel="shortcut icon" href="{{asset('img/favicon.ico')}}">
    <!-- Tweaks for older IEs--><!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script><![endif]-->
</head>
<body>

<div class="page">
    <div id="root"></div>
    <footer class="main-footer">
        <div class="container-fluid">
            <div class="row">
                <div class="col-sm-6">
                    <p>Your company &copy; 2017-2019</p>
                </div>
                <div class="col-sm-6 text-right">
                    <p>Design by <a href="https://bootstrapious.com" class="external">Bootstrapious</a></p>
                    <!-- Please do not remove the backlink to us unless you support further theme's development at https://bootstrapious.com/donate. It is part of the license conditions and it helps me to run Bootstrapious. Thank you for understanding :)-->
                </div>
            </div>
        </div>
    </footer>
</div>
<!-- JavaScript files-->
<script src="{{asset('vendor/jquery/jquery.min.js')}}"></script>
<script src="{{asset('vendor/popper.js/umd/popper.min.js')}}"> </script>
<script src="{{asset('vendor/bootstrap/js/bootstrap.min.js')}}"></script>
<script src="{{asset('js/grasp_mobile_progress_circle-1.0.0.min.js')}}"></script>
<script src="{{asset('vendor/jquery.cookie/jquery.cookie.js')}}"> </script>
<script src="{{asset('vendor/chart.js/Chart.min.js')}}"></script>
<script src="{{asset('vendor/jquery-validation/jquery.validate.min.js')}}"></script>
<script src="{{asset('vendor/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.concat.min.js')}}"></script>
<script src="{{asset('js/charts-home.js')}}"></script>
<!-- Main File-->
<script src="{{asset('js/front.js')}}"></script>
<script src="{{ asset('js/app.js') }}"></script>
</body>

组件文件夹中的App.js(我将默认的Example.js重命名为App.js)

import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import SideBar from './layouts/SideBar';
import Top from './layouts/Top';

export default class App extends Component {
    render() {
        return (
            <div>
                <Top/>
                <SideBar/>
            </div>
        );
    }
}

Top.js

import React, {Component} from 'react';

export default class Top extends Component{
    render(){
        return (
            <header classNameName="header">
                <nav className="navbar">
                    <div className="container-fluid">
                        <div className="navbar-holder d-flex align-items-center justify-content-between">
                            <div className="navbar-header"><a id="toggle-btn" href="#" className="menu-btn"><i className="icon-bars"> </i></a><a href="index.html" className="navbar-brand">
                                <div className="brand-text d-none d-md-inline-block"><span>Bootstrap </span><strong className="text-primary">Dashboard</strong></div></a></div>
                            <ul className="nav-menu list-unstyled d-flex flex-md-row align-items-md-center">
                                <li className="nav-item dropdown"> <a id="notifications" rel="nofollow" data-target="#" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" className="nav-link"><i className="fa fa-bell"></i><span className="badge badge-warning">12</span></a>
                                    <ul aria-labelledby="notifications" className="dropdown-menu">
                                        <li><a rel="nofollow" href="#" className="dropdown-item">
                                            <div className="notification d-flex justify-content-between">
                                                <div className="notification-content"><i className="fa fa-envelope"></i>You have 6 new messages </div>
                                                <div className="notification-time"><small>4 minutes ago</small></div>
                                            </div></a></li>
                                        <li><a rel="nofollow" href="#" className="dropdown-item">
                                            <div className="notification d-flex justify-content-between">
                                                <div className="notification-content"><i className="fa fa-twitter"></i>You have 2 followers</div>
                                                <div className="notification-time"><small>4 minutes ago</small></div>
                                            </div></a></li>
                                        <li><a rel="nofollow" href="#" className="dropdown-item">
                                            <div className="notification d-flex justify-content-between">
                                                <div className="notification-content"><i className="fa fa-upload"></i>Server Rebooted</div>
                                                <div className="notification-time"><small>4 minutes ago</small></div>
                                            </div></a></li>
                                        <li><a rel="nofollow" href="#" className="dropdown-item">
                                            <div className="notification d-flex justify-content-between">
                                                <div className="notification-content"><i className="fa fa-twitter"></i>You have 2 followers</div>
                                                <div className="notification-time"><small>10 minutes ago</small></div>
                                            </div></a></li>
                                        <li><a rel="nofollow" href="#" className="dropdown-item all-notifications text-center"> <strong> <i className="fa fa-bell"></i>view all notifications                                            </strong></a></li>
                                    </ul>
                                </li>
                                <li className="nav-item dropdown"> <a id="messages" rel="nofollow" data-target="#" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" className="nav-link"><i className="fa fa-envelope"></i><span className="badge badge-info">10</span></a>
                                    <ul aria-labelledby="notifications" className="dropdown-menu">
                                        <li><a rel="nofollow" href="#" className="dropdown-item d-flex">
                                            <div className="msg-profile"> <img src="img/avatar-1.jpg" alt="..." className="img-fluid rounded-circle"/></div>
                                            <div className="msg-body">
                                                <h3 className="h5">Jason Doe</h3><span>sent you a direct message</span><small>3 days ago at 7:58 pm - 10.06.2014</small>
                                            </div></a></li>
                                        <li><a rel="nofollow" href="#" className="dropdown-item d-flex">
                                            <div className="msg-profile"> <img src="img/avatar-2.jpg" alt="..." className="img-fluid rounded-circle"/></div>
                                            <div className="msg-body">
                                                <h3 className="h5">Frank Williams</h3><span>sent you a direct message</span><small>3 days ago at 7:58 pm - 10.06.2014</small>
                                            </div></a></li>
                                        <li><a rel="nofollow" href="#" className="dropdown-item d-flex">
                                            <div className="msg-profile"> <img src="img/avatar-3.jpg" alt="..." className="img-fluid rounded-circle"/></div>
                                            <div className="msg-body">
                                                <h3 className="h5">Ashley Wood</h3><span>sent you a direct message</span><small>3 days ago at 7:58 pm - 10.06.2014</small>
                                            </div></a></li>
                                        <li><a rel="nofollow" href="#" className="dropdown-item all-notifications text-center"> <strong> <i className="fa fa-envelope"></i>Read all messages    </strong></a></li>
                                    </ul>
                                </li>
                                <li className="nav-item dropdown"><a id="languages" rel="nofollow" data-target="#" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" className="nav-link language dropdown-toggle"><img src="img/flags/16/GB.png" alt="English"/><span className="d-none d-sm-inline-block">English</span></a>
                                    <ul aria-labelledby="languages" className="dropdown-menu">
                                        <li><a rel="nofollow" href="#" className="dropdown-item"> <img src="img/flags/16/DE.png" alt="English" className="mr-2"/><span>German</span></a></li>
                                        <li><a rel="nofollow" href="#" className="dropdown-item"> <img src="img/flags/16/FR.png" alt="English" className="mr-2"/><span>French</span></a></li>
                                    </ul>
                                </li>
                                <li className="nav-item"><a href="login.html" className="nav-link logout"> <span className="d-none d-sm-inline-block">Logout</span><i className="fa fa-sign-out"></i></a></li>
                            </ul>
                        </div>
                    </div>
                </nav>
            </header>
        );
    }
}

SideBar.js

import React, {Component} from 'react';
export default class SideBar extends Component{
    render(){
        return(
            <nav className="side-navbar">
                <div className="side-navbar-wrapper">
                    <div className="sidenav-header d-flex align-items-center justify-content-center">
                        <div className="sidenav-header-inner text-center"><img src="img/avatar-1.jpg" alt="person" class="img-fluid rounded-circle"/>
                            <h2 className="h5">Anderson Hardy</h2><span>Web Developer</span>
                        </div>
                        <div className="sidenav-header-logo"><a href="index.html" className="brand-small text-center"> <strong>B</strong><strong className="text-primary">D</strong></a></div>
                    </div>
                    <div className="main-menu">
                        <h5 className="sidenav-heading"></h5>
                        <ul id="side-main-menu" className="side-menu list-unstyled">
                            <li><a href="index.html"> <i class="icon-home"></i>Dashboard</a></li>
                            <li><a href="#exampledropdownDropdown" aria-expanded="false" data-toggle="collapse"> <i className="icon-interface-windows"></i>Recipients</a>
                                <ul id="exampledropdownDropdown" class="collapse list-unstyled ">
                                    <li><a href="">New Recipients</a></li>
                                    <li><a href="#">Add to Recipients</a></li>
                                    <li><a href="#">All Recipients</a></li>
                                </ul>
                            </li>
                            <li><a href="index.html"> <i className="icon-flask"></i>SMS Wallet</a></li>
                            <li><a href="forms.html"> <i className="icon-form"></i>Messaging</a></li>
                            <li><a href="tables.html"> <i className="icon-grid"></i>Admins</a></li>
                            <li><a href="charts.html"> <i className="fa fa-sign-out"></i>Logout</a></li>
                        </ul>
                    </div>
                </div>
            </nav>
        );
    }
}

0 个答案:

没有答案