[Vuejs]-How to pass vue data to laravel @include

0👍

Put before your Vue app script in blade template:

<script>
Vue.prototype._data = {!! json_encode(['id' => $id] !!};
</script>

Now, you can access data from Vue like:

methods: {
    test() {
        alert(this._data.id)
    }
}

Leave a comment