Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function index()
- {
- $products = $this->product->list();
- dd($products);
- return view('admin.product.index',compact('products'));
- }
- <section class="content">
- <product-list :product-data="{{json_encode($products)}}" :page="{{json_encode($products->links())}}"></product-list>
- </section>
- <template>
- <div class="box">
- ...
- <table class="table table-list">
- ...
- <tr v-for="item in products" :key="item.id">
- <td>{{item.name}}</td>
- <td>{{item.createdAt}}</td>
- <td>{{item.updatedAt}}</td>
- </tr>
- ...
- </table>
- <div class="box-footer">
- ...
- {{this.page}}
- ...
- </div>
- ...
- </div>
- </template>
- <script>
- export default {
- props: ['productData','page'],
- data(){
- return {
- ...
- products: this.productData.data,
- }
- },
- ...
- }
- </script>
Add Comment
Please, Sign In to add comment