haakym
1186
20
Vue

Using Vue.js in Laravel 5.3

Posted 2 years ago by haakym

In previous Laravel projects, I've dropped Vue.js into a page and created a Vue instance specific for that page. Something like this at the bottom of my page:

<div id="app">
    @{{ message }}
</div>
...
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.27/vue.js"></script>
<script>
        new Vue({
          el: '#app',
          data: {
            message: 'Hello Vue.js!'
          }
        });
</script>

Now in Laravel 5.3 Vue.js comes bundled up with it and I have got a slight grasp on how I can create components which I can then drop into a page. However, I am struggling to understand how I can create a Vue.js instance like the aforementioned, i.e. where I just need to drop a vue instance into a page instead of creating a whole component.

Can I utilise Vue that gets incorporated into app.js when running gulp or do I need to pull in Vue as I did before with the script tag?

Thanks!

Please sign in or create an account to participate in this conversation.