fix: 修复分页组件传值问题及面包屑导航更新

This commit is contained in:
2026-05-20 14:05:18 +08:00
parent 567b9d0519
commit 5f739fae13
9 changed files with 82 additions and 44 deletions

View File

@ -80,34 +80,16 @@ const pageSize = computed({
set: (val: number) => emit('update:pageSizeValue', val),
})
//
watch(
() => currentPage,
(newVal) => {
emit('update:modelValue', newVal)
emit('pagination-change', { currentPage: newVal, pageSize })
},
)
//
watch(
() => pageSize,
(newVal) => {
emit('update:pageSizeValue', newVal)
emit('pagination-change', { currentPage, pageSize: newVal })
},
)
// Element Plus
//
const handleSizeChange = (val: number) => {
emit('update:pageSizeValue', val)
emit('pagination-change', { currentPage, pageSize: val })
emit('pagination-change', { currentPage: currentPage.value, pageSize: val })
}
// Element Plus
//
const handleCurrentChange = (val: number) => {
emit('update:modelValue', val)
emit('pagination-change', { currentPage: val, pageSize })
emit('pagination-change', { currentPage: val, pageSize: pageSize.value })
}
</script>

View File

@ -13,17 +13,68 @@
</template>
<script setup lang="ts">
import { useTabsStore } from '@/stores/modules/tabs'
import { useUserStore } from '@/stores/modules/user'
import type { BreadcrumbItem } from '@/stores/modules/tabs'
interface BreadcrumbItem {
title: string
path: string
const route = useRoute()
const userStore = useUserStore()
//
const breadcrumbList = computed<BreadcrumbItem[]>(() => {
const path = route.path
const list: BreadcrumbItem[] = []
//
if (path === '/dashboard') {
list.push({ title: '首页', path: '/dashboard' })
return list
}
const tabsStore = useTabsStore()
//
const findMenuPath = (menus: any[], targetPath: string, parentMenu: any = null): any => {
for (const menu of menus) {
const menuPath = menu.path || menu.api || `/menu-${menu.id}`
// tabs store
const breadcrumbList = computed<BreadcrumbItem[]>(() => tabsStore.currentBreadcrumbs)
if (menuPath === targetPath) {
return { current: menu, parent: parentMenu }
}
const subMenus = menu.children || menu.son
if (subMenus && subMenus.length > 0) {
const result = findMenuPath(subMenus, targetPath, menu)
if (result) return result
}
}
return null
}
const menuResult = findMenuPath(userStore.sideMenu, path)
if (menuResult) {
const { current, parent } = menuResult
if (parent) {
const firstChildMenus = parent.children || parent.son
const firstChildPath = firstChildMenus && firstChildMenus.length > 0
? (firstChildMenus[0].path || firstChildMenus[0].api || `/menu-${firstChildMenus[0].id}`)
: parent.path || parent.api || `/menu-${parent.id}`
list.push({ title: parent.label, path: firstChildPath })
}
list.push({
title: current.label,
path: current.path || current.api || `/menu-${current.id}`
})
}
//
if (list.length === 0) {
list.push({ title: '首页', path: '/dashboard' })
}
return list
})
</script>
<style scoped lang="scss">

View File

@ -46,7 +46,7 @@
</button>
<!-- 当前页面下拉菜单 -->
<el-dropdown trigger="click" @command="handleDropdownCommand" placement="bottom-end" ref="pageDropdownRef">
<!-- <el-dropdown trigger="click" @command="handleDropdownCommand" placement="bottom-end" ref="pageDropdownRef">
<button class="current-page-btn" @click.stop="togglePageDropdown">
<el-icon><MoreFilled /></el-icon>
</button>
@ -70,7 +70,7 @@
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</el-dropdown> -->
<!-- 右键菜单 -->
<teleport to="body">
@ -448,7 +448,7 @@ const closeContextMenu = () => {
}
&.scroll-btn-right {
right: 66px;
right: 6px;
}
}

View File

@ -485,8 +485,9 @@ const handleGetSubList = async (row: any) => {
/**
* @description: 定义分页方法
*/
const handlePaginationChange = (page: { currentPage: number; size: number }) => {
const handlePaginationChange = (page: { currentPage: number; pageSize: number }) => {
currentPage.value = page.currentPage
pageSize.value = page.pageSize
getCustomerList(userId.value)
}

View File

@ -120,8 +120,8 @@ const handleReset = () => {
searchForm.value = {
username: '',
subAccountId: '',
startTime: '',
endTime: '',
startTime: initTime.start,
endTime: initTime.end,
}
getFundDetailList()
}

View File

@ -12,12 +12,12 @@
<el-button type="primary" size="small" @click.stop="handleWithdraw(row)">取款</el-button>
</template>
</Table>
<Pagination
v-model:page="queryParams.page"
v-model:limit="queryParams.limit"
<!-- <Pagination
v-model="queryParams.page"
v-model:pageSizeValue="queryParams.limit"
:total="total"
@pagination="getList"
/>
@pagination-change="getList"
/> -->
<WithdrawDialog
:visible="withdrawDialogVisible"
:channel-id="currentChannelId"

View File

@ -168,8 +168,9 @@ const handleReset = () => {
/**
* @description: 定义分页方法
*/
const handlePaginationChange = (page: { currentPage: number, size: number }) => {
const handlePaginationChange = (page: { currentPage: number; pageSize: number }) => {
currentPage.value = page.currentPage
pageSize.value = page.pageSize
getCustomerTradeOrderList()
}
</script>

View File

@ -144,7 +144,9 @@ const handleExport = async () => {
/**
* @description: 定义分页方法
*/
const handlePaginationChange = async () => {
const handlePaginationChange = async (page: { currentPage: number; pageSize: number }) => {
currentPage.value = page.currentPage
pageSize.value = page.pageSize
getTransferDetailList()
}
</script>

View File

@ -428,8 +428,9 @@ const handleGetSubList = async (row: any) => {
/**
* @description: 定义分页方法
*/
const handlePaginationChange = (page: { currentPage: number; size: number }) => {
const handlePaginationChange = (page: { currentPage: number; pageSize: number }) => {
currentPage.value = page.currentPage
pageSize.value = page.pageSize
getCustomerList()
}