fix: 优化watch 修改编辑用户弹窗样式

This commit is contained in:
ZhuRui
2026-07-27 09:51:30 +08:00
parent 17d5c85904
commit e3e66ec03b
11 changed files with 146 additions and 161 deletions
+16 -19
View File
@@ -1,6 +1,7 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
// src/hooks/usePagination.ts
import { computed, ref, watch, Ref, triggerRef } from 'vue';
import { computed, ref, Ref, triggerRef } from 'vue';
import { useEffect } from './useEffect';
/**
* 分页配置项
@@ -77,24 +78,20 @@ export function usePagination(options: UsePaginationOptions = {}): UsePagination
const pageSizeRef = ref(options.pageSize ?? defaultPageSize);
const totalRef = ref(options.total ?? 0);
watch(
() => options.current,
(val) => {
if (val !== undefined) currentRef.value = val;
},
);
watch(
() => options.pageSize,
(val) => {
if (val !== undefined) pageSizeRef.value = val;
},
);
watch(
() => options.total,
(val) => {
if (val !== undefined) totalRef.value = val;
},
);
useEffect(() => {
const val = options.current;
if (val !== undefined) currentRef.value = val;
}, [() => options.current]);
useEffect(() => {
const val = options.pageSize;
if (val !== undefined) pageSizeRef.value = val;
}, [() => options.pageSize]);
useEffect(() => {
const val = options.total;
if (val !== undefined) totalRef.value = val;
}, [() => options.total]);
const totalPages = computed(() => {
const total = totalRef.value;