[Vue警告]:编译模板时出错:

时间:2017-11-13 07:33:14

标签: laravel vue.js

我已经问过这个问题(由于不活动而关闭),我一直在尝试许多不同的方法来解决它,但它仍然无法正常工作。我甚至尝试通过跟随许多不同类型的网站删除所有与laravel中的vue相关的内容,他们都告诉我删除vue依赖项。 (这是我关注的链接之一,https://mattstauffer.com/blog/removing-all-vue-dependencies-from-laravel/)我甚至用从头创建的新app.js替换了app.js,因为过去我没有做任何事情

有人可以帮助我,我已经很久没遇到这个问题而且我真的不知道该怎么做。我想要的只是解决此错误"[Vue warn]: Error compiling template:",因为它影响了我的网页中的导航栏

我正在使用laravel框架5.5.7,我甚至没有更新我的laravel直到这个vue。而且我甚至不记得在我的laravel中安装vue。

This is the error they given me:
- Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <script>, as they will not be parsed.
- Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <script>, as they will not be parsed.
- Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <script>, as they will not be parsed.


(found in <Root>)

app.blade.php

<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- CSRF Token -->
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <title>{{ config('app.name', 'Laravel') }}</title>

    <!-- Styles -->
    <link href="{{ asset('css/app.css') }}" rel="stylesheet">
</head>
<body>
    <div id="app">
        <nav class="navbar navbar-default navbar-static-top">
            <div class="container">
                <div class="navbar-header">


                    <!-- Collapsed Hamburger -->
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#app-navbar-collapse" aria-expanded="false">
                        <span class="sr-only">Toggle Navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
<html>
<head>
              <title>SideBar Menu</title>
     <link href="{{ asset('css/style.css') }}" rel="stylesheet">
</head>

<body>

    <div id="sidebar">

        <ul>
            <li><a href="{{route('home')}}">Summary</a></li>        
            <li><a href="{{route('deleted_result')}}">Deleted Records</a></li>
            <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Edit User Information <span class="caret"></span></a>
          <ul class="dropdown-menu forAnimate" role="menu">
            <li><a href="{{ url('/edit') }}" style="color: red">Personal Information Edit</a></li>
            <li><a href="{{ url('/edit0')}}" style="color: red">Driver License Class Edit</a></li>
          </ul>
        </li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Evaluation <span class="caret"></span></a>
          <ul class="dropdown-menu forAnimate" role="menu">
             <li><a href="{{ url('/edit8')}}" style="color: red">Evaluation</a></li>
          </ul>
        </li>

        </ul>

        <div id="sidebar-btn">
            <span></span>
            <span></span>
            <span></span>
        </div>

    </div>


    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script>

    $(document).ready(function(){
        $('#sidebar-btn').click(function(){
            $('#sidebar').toggleClass('visible');
        });
    });

    </script>
    </body>
    </html>

                    <!-- Branding Image -->
                    <a class="navbar-brand" href="{{ url('/') }}" style="color: white">
                        {{ config('app.name', 'Laravel') }}
                    </a>
                </div>

                <div class="collapse navbar-collapse" id="app-navbar-collapse">
                    <!-- Left Side Of Navbar -->
                    <ul class="nav navbar-nav">

                        &nbsp;
                    </ul>
                    <div id="center-text">
                        <ul class="nav navbar-nav navbar-center" id="nav-center">
                            <li>
                                <h3>@yield('title')</h3>
                            </li>
                        </ul>
                    </div>


                    <!-- Right Side Of Navbar -->
                    <ul class="nav navbar-nav navbar-right">
                        <!-- Authentication Links -->
                        @guest
                            <li><a href="{{ route('login') }}">Login</a></li>
                            <li><a href="{{ route('register') }}">Register</a></li>
                        @else
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true" style="background-color:blue" style="color:white">
                                    <b>{{ Auth::user()->name }}</b> <span class="caret"></span>
                                </a>

                                <ul class="dropdown-menu" style="background-color: blue">
                                    <li>
                                        <a href="{{ route('logout') }}"
                                            onclick="event.preventDefault();
                                                     document.getElementById('logout-form').submit();" style="background-color: blue" style="color: white">
                                            <b>Logout</b>
                                        </a>

                                        <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                                            {{ csrf_field() }}
                                        </form>
                                    </li>
                                </ul>
                            </li>
                        @endguest
                    </ul>
                </div>
            </div>
        </nav>

        @yield('content')
    </div>

    <!-- Scripts -->
    <script src="{{ asset('js/app.js') }}"></script>

</body>
</html>

0 个答案:

没有答案