[Vuejs]-Vuejs on Laravel blade

0👍

Can’t see what’s wrong. so the problem is probably with this code

@section('javascript')
    <script>
    new Vue({
      el: '#foo',
      data: {
        message: 'Hello Vue!'
      }
    })
    </script>
@endsection

You might not have yield('javascript') at your layouts/app.blade.php

-1👍

data should be a function that returns an object.

new Vue({
  el: '#foo',
  data: function () {
    return {
      message: 'Hello Vue!'
    }
  }
})

Source: https://v2.vuejs.org/v2/style-guide/#Component-data-essential

👤Harry

Leave a comment