解决排序后刷新表头不显示排序的问题
parent
a014053d98
commit
4e547e43b6
|
@ -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()
|
||||
},
|
||||
// 组件创建完后获取数据,
|
||||
|
|
|
@ -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()
|
||||
},
|
||||
// 组件创建完后获取数据,
|
||||
|
|
Loading…
Reference in New Issue