listelere ve tablar ileri-geri gidildiğinde kaldığı yere dönüyor.
This commit is contained in:
@ -138,7 +138,8 @@
|
||||
</div>
|
||||
<data-table-pagination
|
||||
v-if="pagination !== undefined && showPagination && !isPreview"
|
||||
v-model:pagination="localPagination" />
|
||||
v-model:pagination="localPagination"
|
||||
:isUseRoute="isUseRoute" />
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, watch } from 'vue'
|
||||
@ -146,6 +147,9 @@
|
||||
import { useGlobalStore } from '@/stores/globalStore'
|
||||
import icourl from '@/assets/images/icons.svg'
|
||||
const globalStore = useGlobalStore()
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
||||
interface ITableHead {
|
||||
[key: string]: any
|
||||
@ -178,12 +182,14 @@
|
||||
rowActions?: Record<string, any>[]
|
||||
actionFixed?: boolean
|
||||
rowActionStyle?: string
|
||||
isUseRoute?: boolean
|
||||
}
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
tableData: () => [],
|
||||
rowNumber: false,
|
||||
isPreview: false,
|
||||
actionFixed: false
|
||||
actionFixed: false,
|
||||
isUseRoute: false
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:sortData', 'update:pagination'])
|
||||
@ -254,9 +260,19 @@
|
||||
localSort.value.sortColumn = d.name
|
||||
localSort.value.sortOrder = 'desc'
|
||||
}
|
||||
if (props.isUseRoute) {
|
||||
router.push({
|
||||
query: {
|
||||
...route.query,
|
||||
sortColumn: localSort.value.sortColumn,
|
||||
sortOrder: localSort.value.sortOrder
|
||||
}
|
||||
})
|
||||
}
|
||||
emit('update:sortData', localSort.value)
|
||||
}
|
||||
}
|
||||
|
||||
const CellData = (d: Record<string, any>, key: string): any => {
|
||||
if (d[key] === null) return d
|
||||
else return d[key]
|
||||
|
||||
Reference in New Issue
Block a user