feat: 路由跳转携带参数
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user