Начиная с Vue.js и хотел дать ему попробовать пример, который поставляется с laravel.
Никакой компонент не отображается, и в консоли я получаю
[Vue warn]: Failed to mount component: template or render function not defined.
found in
---> <Example>
<Root>
Не новая установка, обновленная с 5. 2-> 5. 3-> 5.4
ресурсы/активы/JS/app.js
/**
* First we will load all of this project JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
require('./bootstrap');
window.Vue = require('vue');
/**
* 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('example', require('./components/Example.vue'));
const app = new Vue({
el: '#app'
});
ресурсы/активы/JS/компоненты/Example.vue
<template>
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Example Component</div>
<div class="panel-body">
I'm an example component!
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
mounted() {
console.log('Component mounted.')
}
}
</script>
Это клинок, в котором у меня есть js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Testing</title>
<link rel="stylesheet" href="css/app.css">
<meta name="csrf-token" content="{{ csrf_token() }}">
</head>
<body>
<div id="app">
<example></example>
</div>
<script src="js/app.js" charset="utf-8"></script>
</body>
</html>
webpack.mix.js
let mix = require('laravel-mix');
mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css');