[英]Vue component not showing (Laravel 5.3)
我正在嘗試在 Laravel 5.3 上設置 Passport,但 Vue 組件似乎沒有出現在刀片中。
這是我的刀片的代碼:
@extends('connect.frame')
@section('title')
API Settings - KHConnect
@endsection
@section('header')
<!-- Page Header -->
<div class="content page-header" style="margin-bottom: 2em;">
<div class="container">
<h1 style="padding-top: 0.5em;font-size: 4em;">KHConnect</h1>
</div>
</div>
@endsection
@section('body')
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<div class="row">
<passport-clients></passport-clients>
<passport-authorized-clients></passport-authorized-clients>
<passport-personal-access-tokens></passport-personal-access-tokens>
</div>
@endsection
這是我的 app.js 中的代碼:
/**
* First we will load all of this project's JavaScript dependencies which
* include Vue and Vue Resource. This gives a great starting point for
* building robust, powerful web applications using Vue and Laravel.
*/
require('./bootstrap');
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
* or customize the JavaScript scaffolding to fit your unique needs.
*/
Vue.component(
'passport-clients',
require('./components/passport/Clients.vue')
);
Vue.component(
'passport-authorized-clients',
require('./components/passport/AuthorizedClients.vue')
);
Vue.component(
'passport-personal-access-tokens',
require('./components/passport/PersonalAccessTokens.vue')
);
const app = new Vue({
el: '#app'
});
我已經運行gulp
並安裝了 Laravel Elixir,並且正在加載<script src="{{asset('js/vue.min.js')}}"></script>
和<script src="{{asset('js/app.js')}}"></script>
在我的刀片中。
提前致謝。
vue-js vm 需要一個根元素才能工作。 在問題中,根元素 id 是“app”:
const app = new Vue({
el: '#app'
});
但它在頁面的 HTML 中丟失了。 添加一個<div id="app">...</div>
容器解決了評論中看到的問題。
就我而言,我必須在 cli 中運行以下命令:
npm install
npm run production
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.