解决排序后刷新表头不显示排序的问题

main
wuyize 2022-07-14 15:14:32 +08:00
parent a014053d98
commit 4e547e43b6
2 changed files with 12 additions and 0 deletions

View File

@ -11,6 +11,7 @@
ref="tableRef"
class="projectTable"
:height="tableHeight"
:default-sort="defaultSort"
@sort-change="onSortChange"
@row-click="onRowClick"
:data="tableData">
@ -72,6 +73,7 @@ const pageSize = ref(10)
const total = ref(0)
const sortBy = ref(null)
const asc = ref(null)
const defaultSort = ref(null)
const redirect = () => {
router.push({path: '/project/closed', query: {currentPage: currentPage.value, pageSize: pageSize.value, sortBy: sortBy.value, asc: asc.value}})
}
@ -127,6 +129,10 @@ watch(
sortBy.value = router.currentRoute.value.query.sortBy
if (router.currentRoute.value.query.asc)
asc.value = router.currentRoute.value.query.asc
defaultSort.value = {
prop: sortBy.value,
order: asc.value
}
getClosedProjects()
},
//

View File

@ -12,6 +12,7 @@
<el-table
ref="tableRef"
class="projectTable"
:default-sort="defaultSort"
@row-click="onRowClick"
@sort-change="onSortChange"
:height="tableHeight"
@ -87,6 +88,7 @@ const pageSize = ref(10)
const total = ref(0)
const sortBy = ref(null)
const asc = ref(null)
const defaultSort = ref(null)
const redirect = () => {
router.push({path: '/', query: {currentPage: currentPage.value, pageSize: pageSize.value, sortBy: sortBy.value, asc: asc.value}})
}
@ -143,6 +145,10 @@ watch(
sortBy.value = router.currentRoute.value.query.sortBy
if (router.currentRoute.value.query.asc)
asc.value = router.currentRoute.value.query.asc
defaultSort.value = {
prop: sortBy.value,
order: asc.value
}
getProjects()
},
//