douziqian2871 2018-08-03 06:05
浏览 423

如何将laravel模板与Vue.js集成

I have created my website in Laravel 5 with template integrated in it. Now I want to add chat feature in my website, so I decided to use Vue.js. The problem is that when I setup Vue.js in my project, the page template of that page in which vue.js is used is not working. I mean that all the css and js file of laravel getting mess up. Page looks horrible. How Can I use my existing template with Vue.js?

<head>
  <link rel="stylesheet" href="{{ URL('css/style.css?version=2') }}" />
  <link rel="stylesheet" href="{{ URL::asset('css/ionicons.min.css') }}" />
  <meta name="csrf-token" content="{{ csrf_token() }}">
  <link rel="stylesheet" type="text/css" href="{{ asset('css/app.css') }}">
</head>
<body>
        <div id="custom-search-input">
           <div class="input-group col-md-12">
              <input type="text" class="  search-query form-control" placeholder="Conversation" />
              <button class="btn btn-danger" type="button">
              <span class=" glyphicon glyphicon-search"></span>
              </button>
           </div>
        </div>
        <div id="app">
            <example-component></example-component>
        </div>
        <div class="dropdown all_conversation">
           <button class="dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
           <i class="fa fa-weixin" aria-hidden="true"></i>
           All Conversations
           <span class="caret pull-right"></span>
           </button>
           <ul class="dropdown-menu" aria-labelledby="dropdownMenu2">
              <li><a href="#"> All Conversation </a>  <ul class="sub_menu_ list-unstyled">
              <li><a href="#"> All Conversation </a> </li>
              <li><a href="#">Another action</a></li>
              <li><a href="#">Something else here</a></li>
              <li><a href="#">Separated link</a></li>
           </ul>
           </li>
              <li><a href="#">Another action</a></li>
              <li><a href="#">Something else here</a></li>
              <li><a href="#">Separated link</a></li>
           </ul>
        </div>
<script type="text/javascript" src="{{ asset('js/app.js') }}"></script>
</body>

ExampleComponent.vue

    <template>
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-8">
                <div class="card card-default">
                    <div class="card-header">Example Component</div>

                    <div class="card-body">
                        I'm an example component.
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

Console warnings and errors

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 求数学坐标画圆以及直线的算法
    • ¥35 平滑拟合曲线该如何生成
    • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
    • ¥15 名为“Product”的列已属于此 DataTable
    • ¥15 安卓adb backup备份应用数据失败
    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
    • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
    • ¥15 自己瞎改改,结果现在又运行不了了
    • ¥15 链式存储应该如何解决