listelere ve tablar ileri-geri gidildiğinde kaldığı yere dönüyor.
This commit is contained in:
@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user