详情顶部导航跳转

This commit is contained in:
2023-07-26 19:27:30 +08:00
parent 44d99b26ce
commit 77b5e5e6aa
7 changed files with 44 additions and 47 deletions

View File

@@ -146,9 +146,9 @@ let loadFinish = () => {
}
//监听路由
const route = useRoute()
const route = useRouter()
let routePath = ref('')
routePath.value = route.path
routePath.value = route.currentRoute.value.meta.path
//地区数据
let location = reactive({ data: {} })
location.data = store.state.indexData && store.state.indexData.config && store.state.indexData.config.location

View File

@@ -133,8 +133,8 @@ let openInfo = (data) => {
//监听路由
const route = useRoute()
let routePath = ref('')
routePath.value = route.path
tabBtnType.value = route.path
routePath.value = route.meta.path
tabBtnType.value = route.meta.path
</script>
<style scoped>

View File

@@ -142,8 +142,7 @@ let getLocationData = (data) => {
//监听路由
const route = useRouter()
let routePath = ref('')
routePath.value = route.currentRoute.value.path
// console.log(route)
routePath.value = route.currentRoute.value.meta.path
watchEffect(() => {
seachSchoolBtn.data = store.state.seachTypeData[0] ? store.state.seachTypeData[0].where : []
@@ -174,18 +173,6 @@ let seachList = (item) => {
houseingPageType:routePath.value === '/needHousing'?6:routePath.value === '/intermediaryHousing'?1:routePath.value === '/personHousing'?0:0
}
})
// if (routePath.value === '/') {
// route.push({
// path: '/seachPage',
// query: {
// keyword: seachAllType.keyword
// }
// })
// }else{
// setSeachConditions()
// }
// getDataList(seachAllType)
}
//设置搜索数据
@@ -227,7 +214,7 @@ let setHotSeach = (item) => {
//点击选项
let checkBtn = (data, type, areaItem) => {
console.log(data, type, areaItem)
// console.log(data, type, areaItem)
getDataList(type, data, areaItem)
}

View File

@@ -265,10 +265,10 @@ let configData = reactive({ data: {} })
const route = useRouter()
let routePath = ref('')
let routeQuery = reactive({ data: {} })
routePath.value = route.currentRoute.value.path
if(route.currentRoute.value.params.type){
routePath.value = route.currentRoute.value.meta.path
if (route.currentRoute.value.params.type) {
routeQuery.data = route.currentRoute.value.params
}else{
} else {
routeQuery.data = route.currentRoute.value.query
}
const { proxy } = getCurrentInstance()
@@ -575,6 +575,7 @@ let cleanSelect = () => {
//根据路由设置参数
let setRouterQuerySet = ref(true)
let routerQuerySet = () => {
console.log(123, routeQuery)
if (!setRouterQuerySet.value) return
//路由参数设置
if ((routeQuery.data && routeQuery.data.houseingPageType === '1') || (routePath.value === '/intermediaryHousing')) {
@@ -595,11 +596,20 @@ let routerQuerySet = () => {
hireTypeObj.title = data.name
hireTypeObj.hireId = type == 1 ? '合租' : type == 2 ? '整租' : '不限'
} else if (routeQuery.data.type === 'location') {
let areaItem = JSON.parse(routeQuery.data.areaItem)
selectTabCheck.id = areaItem.id;
let areaItem = routeQuery.data.areaItem?JSON.parse(routeQuery.data.areaItem):''
selectTabCheck.id = areaItem.id * 1;
selectTabCheck.title = areaItem.name
selectTabCheck.data = list[areaItem.id].data;
selectData.data = seachAreaId(data)
console.log(selectData.data.length)
if (routeQuery.data.types) {
let types = JSON.parse(routeQuery.data.types)
let {data} = types
let type = data.id.toString().substring(0, 1)
hireTypeObj.id = selectData.data.length==0?'':data.id
hireTypeObj.title =selectData.data.length==0?'':data.name
hireTypeObj.hireId = type == 1 ? '合租' : type == 2 ? '整租' : '不限'
}
setCheckBoxData(data)//设置地区选项
}
}
@@ -612,7 +622,7 @@ watchEffect(() => {
if (configData.data) {
hireTypeArr[1].hireType = setHireTypeArr(store.state.seachTypeData[2] ? store.state.seachTypeData[2].where[0].data : [], 1)
hireTypeArr[2].hireType = setHireTypeArr(store.state.seachTypeData[2] ? store.state.seachTypeData[2].where[1].data : [], 2)
console.log('route',route)
console.log('route', route)
if (setRouterQuerySet.value) {
setRegionList()//设置地区数据
setSchoolData()//设置学校数据