Learning vue, setting it up with Laravel, as project is small I am avoiding npm and importing files via cdn but getting error
[Vue warn]: Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the "name" option.
(found in )
app.js:36567 [Vue warn]: Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the "name" option.
1) index.blade.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>AdminLTE 2 | Dashboard</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<meta name="csrf-token" content="">
@include('master.partials.css')
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper" id="app">
@include('master.partials.header')
<!-- Left side column. contains the logo and sidebar -->
@include('master.partials.leftSideBar')
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<router-view></router-view>
@yield('content')
</div>
<!-- /.content-wrapper -->
@include('master.partials.footer')
</div>
<!-- ./wrapper -->
@include('master.partials.js')
<script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>
</body>
</html>
2) master.partials.leftSideBar contains router-link
<li class="active treeview">
<router-link to="/dashboard">Dashboard</router-link>
<a href="#">
<i class="fa fa-dashboard"></i> <span>Dashboard</span>
</a>
</li>
3) resource/js/app.js
require('./bootstrap');
window.Vue = require('vue');
Vue.use(VueRouter);
Vue.component('example-component', require('./components/ExampleComponent.vue'));
const routes = [
{ path: '/dashboard', component: require('./components/dashboard/index.vue') }
]
const app = new Vue({
router
}).$mount('#app')
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire