Commit a8f5d558 authored by 王玉鑫's avatar 王玉鑫

feat: 首页产业分类搜索逻辑修改

parent df1ffc78
......@@ -271,11 +271,20 @@ const toList = () => {
['provinceName', selectedCity.value],
].filter(([, v]) => !!v),
);
const query: any = {};
// 产业分类
if (name === RouteName.industryCategory) {
if (searchParams.name) {
query.category = searchParams.name;
}
Reflect.deleteProperty(searchParams, 'name');
}
query.searchParams = !isEmpty(searchParams) ? JSON.stringify(searchParams) : undefined;
open({
name,
query: {
searchParams: !isEmpty(searchParams) ? JSON.stringify(searchParams) : undefined,
},
query,
});
};
......
......@@ -114,6 +114,7 @@ import CarrierListItemView from '@/components/list/list-carrier-item.vue';
import LandListItemView from '@/components/list/list-land-item.vue';
import ParkItem from '@/components/list/ParkItem.vue';
import FilterView from '@/components/filter/filter-view.vue';
import { useRoute } from 'vue-router';
type tabItem = {
name: string;
......@@ -122,8 +123,15 @@ type tabItem = {
apiURL: RequestUrl;
};
const searchKey = ref<string>('');
const keyWords = ref<string>('');
const route = useRoute();
/** 初始的分类值 */
const getInitCategory = () => {
return (route.query.category as string) || '';
};
const searchKey = ref<string>(getInitCategory());
const keyWords = ref<string>(searchKey.value);
/** 更改target 不会触发响应式更新 */
const currentUrl = shallowRef({ target: RequestUrl.developZoneList });
const directionList = ref<any[]>([]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment