我在具有两个组件的示例代码下尝试了laravel 5.7和vue项目。但是我有一个错误。
出现该错误。
[Vue警告]:无法装入组件:模板或渲染函数未定义。
有人可以帮我解决这个问题吗?
master.blade.php
<nav class="mt-2">
<ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
<li class="nav-item has-treeview menu-open">
<a href="#" class="nav-link active">
<i class="nav-icon fa fa-dashboard"></i>
<p>
Dashboard
<i class="right fa fa-angle-left"></i>
</p>
</a>
<ul class="nav nav-treeview">
<li class="nav-item">
<router-link to="/dashboard" class="nav-link">
<i class="fa fa-circle-o nav-icon"></i>
<p>Dashboard</p>
</router-link>
</li>
<li class="nav-item">
<router-link to="/profile" class="nav-link">
<i class="fa fa-circle-o nav-icon"></i>
<p>Profile</p>
</router-link>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<section class="content">
<div class="container-fluid">
<router-view></router-view>
</div>
</section>
app.js
require('./bootstrap');
window.Vue = require('vue');
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
let Dashboard = require('./components/Dashboard.vue');
let Profile = require('./components/Profile.vue');
let routes = [
{ path: '/dashboard', component: Dashboard },
{ path: '/profile', component: Profile }
]
const router = new VueRouter({
//mode: 'history',
routes // short for `routes: routes`
})
const app = new Vue({
el: '#app',
router
});