- 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:
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="breadcrumb-wrapper">
|
||||
<icon-button
|
||||
@click="$router.go(-1)"
|
||||
@click="props.go ? $router.push(go!) : $router.go(-1)"
|
||||
icon="arrow"
|
||||
classList="breadcrumbs-back breadcrumb-link" />
|
||||
<div class="breadcrumbs-list">
|
||||
@ -13,5 +13,6 @@
|
||||
<script setup lang="ts">
|
||||
const props = defineProps<{
|
||||
currentPageText: string
|
||||
go?: string
|
||||
}>()
|
||||
</script>
|
||||
|
||||
@ -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>
|
||||
|
||||
Reference in New Issue
Block a user