- breadcrum geri butonu için manuel atamalar eklendi

- Tablar için route linklemesi eklendi
- piyango detay tabları için routelar düzenlendi
This commit is contained in:
M. Bestami
2025-10-02 12:43:05 +03:00
parent 07c73d39db
commit 5e83a11ecc
25 changed files with 96 additions and 53 deletions

View File

@ -32,19 +32,24 @@
</div>
</template>
<script setup lang="ts">
import { ref, computed, onMounted, watch } from 'vue'
import { ref, computed, onMounted, onBeforeMount, watch } from 'vue'
import { useGlobalStore } from '@/stores/globalStore'
const globalStore = useGlobalStore()
import { useRouter, useRoute } from 'vue-router'
const router = useRouter()
const route = useRoute()
interface TabObj {
[key: string]: any
text: string
id: string
}
const props = defineProps<{
export interface Props {
tabList: TabObj[]
}>()
route?: boolean
}
const props = withDefaults(defineProps<Props>(), { route: false })
const currentTab = ref<number>(0)
const rnd = ref<number>(Math.ceil(Number(Math.random() * 1000000000)))
@ -79,6 +84,11 @@
} else {
currentTab.value = Number(d)
}
if (props.route) {
router.push({
params: { ...route.params, tabid: props.tabList[currentTab.value].id }
})
}
CalculateNavPosition()
}
const TabWidth = () => {
@ -96,14 +106,32 @@
TabWidth()
CalculateNavPosition()
}
const RouteTabControl = () => {
if (props.route) {
if (route.params.tabid !== undefined && route.params.tabid !== '') {
currentTab.value = props.tabList.findIndex((t) => t.id === route.params.tabid)
}
}
}
onMounted(() => {
TabWidth()
window.addEventListener('resize', Resize)
})
onBeforeMount(() => {
RouteTabControl()
})
watch(
() => globalStore.sideMenu,
() => {
TabWidth()
}
)
watch(
() => route.params.tabid,
(t) => {
console.log('---')
RouteTabControl()
},
{ immediate: true }
)
</script>