Reputation: 433
I have compiled the assets and ran
npm install followed by npm run watch
using the example Vue file that comes build in I changed welcome.blade to
<body>
<div id="app">
<Example></Example>
</div>
<script href="{{URL::asset('js/app.js')}}" charset="utf-8"></script>
</body>
</html>
and also install Vue dev tools and nothing is viewing at all
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>
app.js
/**
* First we will load all of this project's 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'
});
Upvotes: 0
Views: 940
Reputation: 352
You just need to add
<script src="{{ mix('js/app.js') }}"></script>
before de </body>
tag.
In this way to are adding the mix that contains the Vue library, components, and so much more.
I Hope this helps.
Upvotes: 2