Please tell me in this question with Vue.
There are posts with categories. There is a dynamic menu, by clicking on which, posts from this category with a paginator would be displayed. How, when you click on a menu item, transfer the data set of the selected category to the post-component so that it displays it.
v-on: click = "getcat (cat_id)" in the menu receives data, but how to display it in the post-component?
With vue only began to understand, it is quite possible that I took the absolutely wrong path.
welcome.blade.php
<div class="col-md-3"> @if($menu) @foreach ($menu as $mm) @include('mitems', ['item'=>$mm]) @endforeach @endif </div> <div class="col-md-9"> <post-component></post-component> </div> post-component.vue
<template> <div> <div v-for="post in laravelData.data"> //информация </div> <pagination :limit="5" :data="laravelData" @pagination-change-page="getResults"></pagination> </div> </template> <script> export default { data() { return { laravelData: {}, } }, created() { this.getResults(); }, methods: { getResults(page) { if (typeof page === 'undefined') { page = 1; } this.$http.get('/post?page=' + page) .then(response => { return response.json(); }).then(data => { this.laravelData = data; }); }, } } </script> app.js
const app = new Vue({ el: '#root', methods : { getcat: function (key) { this.$http.get('/post?cat_id=' + key) .then(response => { return response.json(); }).then(data => { this.laravelData = data; }); }, } });
welcome.blade.php,@if, not ssr? And I took what I tried to run it on a large ssr project, and it did not end in success. But if you have examples of implementation, I will be glad to see - Artem Gorlachev