feat: 路由跳转携带参数

This commit is contained in:
2026-04-15 15:08:59 +08:00
parent be7ce97a3c
commit abc73d759f
2 changed files with 11 additions and 5 deletions

View File

@@ -365,9 +365,9 @@ const handleChangeLanguage = (language) => {
const handleBtnClick = () => {
const lang = route.params.lang ? `/${route.params.lang}` : ''
if (btnType.value === 'index') {
router.push(`${lang}/contestants`)
router.push({ path: `${lang}/contestants`, query: { ...route.query } })
} else {
router.push(`${lang}/`)
router.push({ path: `${lang}/`, query: { ...route.query } })
}
}
</script>

View File

@@ -32,7 +32,7 @@
<script setup lang="ts">
import { ref, computed, onMounted, provide, onUnmounted } from 'vue'
import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router'
import { useRouter, useRoute } from 'vue-router'
import JudgesSection from './components/JudgesSection.vue'
import SelectionSection from './components/SelectionSection.vue'
import ApplySection from './components/ApplySection.vue'
@@ -50,6 +50,7 @@ import { useIsMobile, useIsTablet } from '@/utils/isMobile'
const { isMobile } = useIsMobile()
const { isTablet } = useIsTablet()
const router = useRouter()
const route = useRoute()
const { locale } = useI18n()
provide('isMobile', isMobile)
@@ -57,7 +58,7 @@ provide('isMobile', isMobile)
provide('isPad', isTablet)
onMounted(() => {
router.replace('/')
// router.replace('/')
// setTimeout(() => {
// console.log('是否平板-------', isTablet.value)
// console.log('是否移动端-------', isMobile.value)
@@ -81,7 +82,12 @@ const bannerUrl = computed(() => {
})
const handleSubmitApplication = () => {
router.push('/contestants')
router.push({
path: '/contestants',
query: {
...route.query
}
})
}
</script>