liu пре 6 година
родитељ
комит
bc154b0f48
1 измењених фајлова са 13 додато и 8 уклоњено
  1. 13
    8
      hksystem/src/views/product/index.vue

+ 13
- 8
hksystem/src/views/product/index.vue Прегледај датотеку

@@ -23,7 +23,7 @@
23 23
                     </p>
24 24
                     <div class="edittable-table-height-con">
25 25
                         <Table :columns="columns" :data="prosHandle"></Table>
26
-                        <Page :total="total" :page-size="pageSize"></Page>
26
+                        <Page :total="total" :page-size="pageSize" @on-change="getData"></Page>
27 27
                     </div>
28 28
                 </Card>
29 29
             </Col>
@@ -108,11 +108,13 @@ export default {
108 108
                                         let id = params.row.id;
109 109
                                         this.axios.delete(`/product/${id}`)
110 110
                                             .then((res) => {
111
+                                                console.log(this.products);
111 112
                                                 this.products = this.products.filter((product) => {
112 113
                                                     if (product.id != id) {
113 114
                                                         return true;
114 115
                                                     }
115 116
                                                 });
117
+                                                console.log(this.products);
116 118
                                             });
117 119
                                     }
118 120
                                 }
@@ -133,13 +135,16 @@ export default {
133 135
             this.proShow = true;
134 136
             this.getData();
135 137
         },
136
-        getData () {
137
-            this.axios.get("products")
138
-                .then((res) => {
139
-                    this.products = res.data.data;
140
-                    this.pageSize = res.data.per_page;
141
-                    this.total = res.data.total;
142
-                });
138
+        getData (num) {
139
+            this.axios.get("products", {
140
+                params: {
141
+                    page: num || 1
142
+                }
143
+            }).then((res) => {
144
+                this.products = res.data.data;
145
+                this.pageSize = res.data.per_page;
146
+                this.total = res.data.total;
147
+            });
143 148
         }
144 149
     },
145 150
     created () {

Loading…
Откажи
Сачувај