Commit 3f5d51248101faaed5fdbbea5f2ed9dadfdfd706

Authored by 张红振
1 parent 5878530d

fix bug

src/components/Pagination/index.vue
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 * 分页 3 * 分页
4 * @module Pagination 4 * @module Pagination
5 */ 5 */
6 - 6 +import { computed } from "vue";
7 import { scrollTo } from "@/utils/scroll"; 7 import { scrollTo } from "@/utils/scroll";
8 8
9 // TIP 每个属性都必传,不带默认值 9 // TIP 每个属性都必传,不带默认值
@@ -37,6 +37,27 @@ const props = withDefaults(defineProps<Props>(), { @@ -37,6 +37,27 @@ const props = withDefaults(defineProps<Props>(), {
37 currentPage: 1, 37 currentPage: 1,
38 }); 38 });
39 39
  40 +const emit = defineEmits<{
  41 + (e: "pageChange", curPage: number, curSize: number, tagName: string): void;
  42 + (e: "update:currentPage", val);
  43 + (e: "update:pageSize", val);
  44 +}>();
  45 +
  46 +/**
  47 + * 监听当前分页改变
  48 + */
  49 +const updateCurrentPage = (val) => {
  50 + console.log(val);
  51 + emit("update:currentPage", val);
  52 +};
  53 +/**
  54 + * 监听个数改变
  55 + */
  56 +const updatePageSize = (val) => {
  57 + console.log(val);
  58 + emit("update:pageSize", val);
  59 +};
  60 +
40 /** 61 /**
41 * @method handleSizeChange 62 * @method handleSizeChange
42 * @description 每页内容条数变化响应 63 * @description 每页内容条数变化响应
@@ -53,20 +74,19 @@ const handleCurrentChange = (val) =&gt; { @@ -53,20 +74,19 @@ const handleCurrentChange = (val) =&gt; {
53 scrollTo(0, 800); 74 scrollTo(0, 800);
54 emit("pageChange", val, props.pageSize, props.tagName); 75 emit("pageChange", val, props.pageSize, props.tagName);
55 }; 76 };
56 -const emit = defineEmits<{  
57 - (e: "pageChange", curPage: number, curSize: number, tagName: string): void;  
58 -}>();  
59 </script> 77 </script>
60 78
61 <template> 79 <template>
62 <div class="pagination-container"> 80 <div class="pagination-container">
63 <el-pagination 81 <el-pagination
64 - v-model:current-page="currentPage" 82 + v-model:currentPage="currentPage"
65 :page-sizes="pageSizes" 83 :page-sizes="pageSizes"
66 - :page-size="pageSize" 84 + v-model:pageSize="pageSize"
67 layout="total, sizes, prev, pager, next, jumper" 85 layout="total, sizes, prev, pager, next, jumper"
68 :total="total" 86 :total="total"
69 - background 87 + background
  88 + :onUpdate:currentPage="updateCurrentPage"
  89 + :onUpdate:pageSize="updatePageSize"
70 @size-change="handleSizeChange" 90 @size-change="handleSizeChange"
71 @current-change="handleCurrentChange" 91 @current-change="handleCurrentChange"
72 > 92 >
src/views/community/housekeeper/changeAdmin.vue
@@ -155,8 +155,8 @@ watchEffect(() =&gt; { @@ -155,8 +155,8 @@ watchEffect(() =&gt; {
155 <Pagination 155 <Pagination
156 v-if="data.total > 0" 156 v-if="data.total > 0"
157 :total="data.total" 157 :total="data.total"
158 - :currentPage="searchData.page"  
159 - :pageSize="searchData.pageSize" 158 + v-model:currentPage="searchData.page"
  159 + v-model:pageSize="searchData.pageSize"
160 @pageChange="search" 160 @pageChange="search"
161 ></Pagination> 161 ></Pagination>
162 </div> 162 </div>
src/views/community/housekeeper/index.vue
@@ -112,10 +112,10 @@ const changeSuccess: void = () =&gt; { @@ -112,10 +112,10 @@ const changeSuccess: void = () =&gt; {
112 changeObj.changeVisible = false; 112 changeObj.changeVisible = false;
113 search(); 113 search();
114 }; 114 };
115 -const changeClose=()=>{  
116 - changeObj.currBuildingId =null;  
117 - changeObj.originalId =null;  
118 -} 115 +const changeClose = () => {
  116 + changeObj.currBuildingId = null;
  117 + changeObj.originalId = null;
  118 +};
119 /** 119 /**
120 * 监听路由参数变换 120 * 监听路由参数变换
121 */ 121 */
@@ -203,8 +203,8 @@ watchEffect(() =&gt; { @@ -203,8 +203,8 @@ watchEffect(() =&gt; {
203 <Pagination 203 <Pagination
204 v-if="data.total > 0" 204 v-if="data.total > 0"
205 :total="data.total" 205 :total="data.total"
206 - :currentPage="searchData.page"  
207 - :pageSize="searchData.pageSize" 206 + v-model:currentPage="searchData.page"
  207 + v-model:pageSize="searchData.pageSize"
208 @pageChange="search" 208 @pageChange="search"
209 ></Pagination> 209 ></Pagination>
210 210
@@ -228,10 +228,10 @@ watchEffect(() =&gt; { @@ -228,10 +228,10 @@ watchEffect(() =&gt; {
228 v-model="changeObj.changeVisible" 228 v-model="changeObj.changeVisible"
229 title="更换楼管" 229 title="更换楼管"
230 width="60%" 230 width="60%"
231 - @close="changeClose" 231 + @close="changeClose"
232 > 232 >
233 <ChangeAdmin 233 <ChangeAdmin
234 - @success="changeSuccess" 234 + @success="changeSuccess"
235 :buildingId="changeObj.currBuildingId" 235 :buildingId="changeObj.currBuildingId"
236 :originalIds="changeObj.originalId" 236 :originalIds="changeObj.originalId"
237 ></ChangeAdmin> 237 ></ChangeAdmin>
src/views/community/houses/buildOwner.vue
@@ -207,8 +207,8 @@ watchEffect(() =&gt; { @@ -207,8 +207,8 @@ watchEffect(() =&gt; {
207 <Pagination 207 <Pagination
208 v-if="data.total > 0" 208 v-if="data.total > 0"
209 :total="data.total" 209 :total="data.total"
210 - :currentPage="searchData.page"  
211 - :pageSize="searchData.pageSize" 210 + v-model:currentPage="searchData.page"
  211 + v-model:pageSize="searchData.pageSize"
212 @pageChange="search" 212 @pageChange="search"
213 ></Pagination> 213 ></Pagination>
214 </div> 214 </div>
src/views/community/houses/index.vue
@@ -196,8 +196,8 @@ watchEffect(() =&gt; { @@ -196,8 +196,8 @@ watchEffect(() =&gt; {
196 <Pagination 196 <Pagination
197 v-if="data.total > 0" 197 v-if="data.total > 0"
198 :total="data.total" 198 :total="data.total"
199 - :currentPage="searchData.page"  
200 - :pageSize="searchData.pageSize" 199 + v-model:currentPage="searchData.page"
  200 + v-model:pageSize="searchData.pageSize"
201 @pageChange="search" 201 @pageChange="search"
202 ></Pagination> 202 ></Pagination>
203 203
src/views/community/houses/relieve.vue
@@ -137,8 +137,8 @@ watchEffect(() =&gt; { @@ -137,8 +137,8 @@ watchEffect(() =&gt; {
137 <Pagination 137 <Pagination
138 v-if="data.total > 0" 138 v-if="data.total > 0"
139 :total="data.total" 139 :total="data.total"
140 - :currentPage="searchData.page"  
141 - :pageSize="searchData.pageSize" 140 + v-model:currentPage="searchData.page"
  141 + v-model:pageSize="searchData.pageSize"
142 @pageChange="search" 142 @pageChange="search"
143 ></Pagination> 143 ></Pagination>
144 </div> 144 </div>
src/views/community/residence/index.vue
@@ -144,8 +144,8 @@ onMounted(() =&gt; { @@ -144,8 +144,8 @@ onMounted(() =&gt; {
144 <Pagination 144 <Pagination
145 v-if="data.total > 0" 145 v-if="data.total > 0"
146 :total="data.total" 146 :total="data.total"
147 - :currentPage="searchData.page"  
148 - :pageSize="searchData.pageSize" 147 + v-model:currentPage="searchData.page"
  148 + v-model:pageSize="searchData.pageSize"
149 @pageChange="search" 149 @pageChange="search"
150 ></Pagination> 150 ></Pagination>
151 151
src/views/housekeeper/buildinMganager/index.vue
@@ -156,8 +156,8 @@ onMounted(() =&gt; { @@ -156,8 +156,8 @@ onMounted(() =&gt; {
156 <Pagination 156 <Pagination
157 v-if="data.total > 0" 157 v-if="data.total > 0"
158 :total="data.total" 158 :total="data.total"
159 - :currentPage="searchData.page"  
160 - :pageSize="searchData.pageSize" 159 + v-model:currentPage="searchData.page"
  160 + v-model:pageSize="searchData.pageSize"
161 @pageChange="search" 161 @pageChange="search"
162 ></Pagination> 162 ></Pagination>
163 163
src/views/ownerManagement/owner/index.vue
@@ -242,8 +242,8 @@ watchEffect(() =&gt; { @@ -242,8 +242,8 @@ watchEffect(() =&gt; {
242 <Pagination 242 <Pagination
243 v-if="data.total > 0" 243 v-if="data.total > 0"
244 :total="data.total" 244 :total="data.total"
245 - :currentPage="searchData.page"  
246 - :pageSize="searchData.pageSize" 245 + v-model:currentPage="searchData.page"
  246 + v-model:pageSize="searchData.pageSize"
247 @pageChange="search" 247 @pageChange="search"
248 ></Pagination> 248 ></Pagination>
249 249
src/views/property/index.vue
@@ -213,8 +213,8 @@ onMounted(() =&gt; { @@ -213,8 +213,8 @@ onMounted(() =&gt; {
213 </el-table> 213 </el-table>
214 <Pagination 214 <Pagination
215 :total="data.params.total" 215 :total="data.params.total"
216 - :currentPage="data.params.query.page"  
217 - :pageSize="data.params.query.pageSize" 216 + v-model:currentPage="data.params.query.page"
  217 + v-model:pageSize="data.params.query.pageSize"
218 @pageChange="handlePageChange" 218 @pageChange="handlePageChange"
219 ></Pagination> 219 ></Pagination>
220 </div> 220 </div>