listelere ve tablar ileri-geri gidildiğinde kaldığı yere dönüyor.

This commit is contained in:
M. Bestami
2025-10-02 21:18:49 +03:00
parent cab06c51a2
commit 0e3c6e658f
31 changed files with 413 additions and 119 deletions

View File

@ -46,10 +46,10 @@
}
export interface Props {
tabList: TabObj[]
route?: boolean
isUseRoute?: boolean
}
const props = withDefaults(defineProps<Props>(), { route: false })
const props = withDefaults(defineProps<Props>(), { isUseRoute: false })
const currentTab = ref<number>(0)
const rnd = ref<number>(Math.ceil(Number(Math.random() * 1000000000)))
@ -84,7 +84,7 @@
} else {
currentTab.value = Number(d)
}
if (props.route) {
if (props.isUseRoute) {
router.push({
params: { ...route.params, tabid: props.tabList[currentTab.value].id }
})
@ -107,7 +107,7 @@
CalculateNavPosition()
}
const RouteTabControl = () => {
if (props.route) {
if (props.isUseRoute) {
if (route.params.tabid !== undefined && route.params.tabid !== '') {
currentTab.value = props.tabList.findIndex((t) => t.id === route.params.tabid)
}
@ -129,7 +129,6 @@
watch(
() => route.params.tabid,
(t) => {
console.log('---')
RouteTabControl()
},
{ immediate: true }