diff --git a/package.json b/package.json index 49374ae..01a2fff 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "dependencies": { "@ant-design/icons-vue": "^7.0.1", "@element-plus/icons-vue": "2.3.1", - "ant-design-vue": "4.x", + "ant-design-vue": "~4.1.2", "axios": "1.6.5", "dayjs": "1.11.10", "element-plus": "2.5.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d394302..6de735c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,7 +12,7 @@ dependencies: specifier: 2.3.1 version: 2.3.1(vue@3.4.15) ant-design-vue: - specifier: 4.x + specifier: ~4.1.2 version: 4.1.2(vue@3.4.15) axios: specifier: 1.6.5 diff --git a/src/components/ThemeSwitch/index.vue b/src/components/ThemeSwitch/index.vue index 229c798..98801f2 100644 --- a/src/components/ThemeSwitch/index.vue +++ b/src/components/ThemeSwitch/index.vue @@ -9,23 +9,25 @@ const handleThemeItemClick = (value: ThemeName) => { diff --git a/src/hooks/usePagination.ts b/src/hooks/usePagination.ts index 7fb0901..b053d22 100644 --- a/src/hooks/usePagination.ts +++ b/src/hooks/usePagination.ts @@ -36,6 +36,10 @@ export function usePagination(initialPaginationData: PaginationData = {}) { const handleSizeChange = (value: number) => { paginationData.pageSize = value; }; + const handlePaginationChange = (page: number, pageSize: number) => { + handleCurrentChange(page); + handleSizeChange(pageSize); + }; - return { paginationData, handleCurrentChange, handleSizeChange }; + return { paginationData, handleCurrentChange, handleSizeChange, handlePaginationChange }; } diff --git a/src/layouts/components/NavigationBar/index.vue b/src/layouts/components/NavigationBar/index.vue index ddffef7..666eb47 100644 --- a/src/layouts/components/NavigationBar/index.vue +++ b/src/layouts/components/NavigationBar/index.vue @@ -1,11 +1,11 @@ @@ -11,10 +11,12 @@ const { loading, options, value } = useFetchSelect({

该示例是演示:通过 hook 自动调用 api 后拿到 Select 组件需要的数据并传递给 Select 组件

Select 示例
- - - -
Select V2 示例(如果数据量过多,可以选择该组件)
- + + + {{ item.label }} + + +
Select V2 示例(如果数据量过多,虚拟滚动技术)
+
diff --git a/src/views/menu/menu1/index.vue b/src/views/menu/menu1/index.vue index 4215ad4..d6f8e77 100644 --- a/src/views/menu/menu1/index.vue +++ b/src/views/menu/menu1/index.vue @@ -10,9 +10,9 @@ src/config/route.ts - + - + diff --git a/src/views/menu/menu1/menu1-2/index.vue b/src/views/menu/menu1/menu1-2/index.vue index 79eb6d5..ffa1dbb 100644 --- a/src/views/menu/menu1/menu1-2/index.vue +++ b/src/views/menu/menu1/menu1-2/index.vue @@ -1,7 +1,7 @@ diff --git a/src/views/permission/directive.vue b/src/views/permission/directive.vue index 7b05de8..768cfca 100644 --- a/src/views/permission/directive.vue +++ b/src/views/permission/directive.vue @@ -16,38 +16,42 @@ const handleRolesChange = () => {
- + 这里采用了 v-permission="['admin']" 所以只有 admin 可以看见这句话 - +
- + 这里采用了 v-permission="['editor']" 所以只有 editor 可以看见这句话 - +
- + 这里采用了 v-permission="['admin', 'editor']" 所以 admin 和 editor 都可以看见这句话 - +
- + 例如 Element Plus 的 el-tab-pane 或 el-table-column 以及其它动态渲染 Dom 的场景不适合使用 v-permission,这种情况下你可以通过 v-if 和 checkPermission 来实现: - - - - 这里采用了 v-if="checkPermission(['admin'])" 所以只有 admin 可以看见这句话 - - - 这里采用了 v-if="checkPermission(['editor'])" 所以只有 editor 可以看见这句话 - - - 这里采用了 v-if="checkPermission(['admin', 'editor'])" 所以 admin 和 editor 都可以看见这句话 - - + + + + + 这里采用了 v-if="checkPermission(['admin'])" 所以只有 admin 可以看见这句话 + + + 这里采用了 v-if="checkPermission(['editor'])" 所以只有 editor + 可以看见这句话 + + + 这里采用了 v-if="checkPermission(['admin', 'editor'])" 所以 admin 和 + editor 都可以看见这句话 + + +
@@ -56,6 +60,7 @@ const handleRolesChange = () => { .margin-top-15 { margin-top: 15px; } + .margin-top-30 { margin-top: 30px; } diff --git a/src/views/permission/page.vue b/src/views/permission/page.vue index 8212d9e..72fed56 100644 --- a/src/views/permission/page.vue +++ b/src/views/permission/page.vue @@ -11,12 +11,12 @@ const handleRolesChange = () => { diff --git a/src/views/table/element-plus/index.vue b/src/views/table/element-plus/index.vue index 49f8ac5..e667317 100644 --- a/src/views/table/element-plus/index.vue +++ b/src/views/table/element-plus/index.vue @@ -20,7 +20,7 @@ defineOptions({ }); const loading = ref(false); -const { paginationData, handleCurrentChange, handleSizeChange } = usePagination(); +const { paginationData, handlePaginationChange } = usePagination(); //#region 增 const dialogVisible = ref(false); @@ -175,16 +175,16 @@ watch([() => paginationData.currentPage, () => paginationData.pageSize], getTabl @@ -197,16 +197,20 @@ watch([() => paginationData.currentPage, () => paginationData.pageSize], getTabl
- + :show-total="(total: number) => `共 ${total} 条`" + v-model:page-size="paginationData.pageSize" + v-model:current="paginationData.currentPage" + show-size-changer + show-quick-jumper + @change="handlePaginationChange" + > + +