头部搜索定位到搜索列表
This commit is contained in:
@@ -57,7 +57,7 @@ const search = () => {
|
|||||||
document.querySelector('#golbalSearch').blur();
|
document.querySelector('#golbalSearch').blur();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
router.push({ name: 'Search', query: { val: searchStr.value || '', type: route?.query?.type || 'License' }});
|
router.push({ name: 'Search', query: { searchWord: searchStr.value || '', type: route?.query?.type || 'software' }});
|
||||||
};
|
};
|
||||||
const handleClear = () => {
|
const handleClear = () => {
|
||||||
router.push({ name: 'home' });
|
router.push({ name: 'home' });
|
||||||
|
|||||||
@@ -107,7 +107,7 @@
|
|||||||
import AdvanceSearch from '@/components/AdvanceSearch/index.vue'
|
import AdvanceSearch from '@/components/AdvanceSearch/index.vue'
|
||||||
import SettingTitle from '@/components/Setting/SettingTitle/index.vue';
|
import SettingTitle from '@/components/Setting/SettingTitle/index.vue';
|
||||||
import SettingText from '@/components/Setting/SettingText/index.vue';
|
import SettingText from '@/components/Setting/SettingText/index.vue';
|
||||||
import { ref,reactive, onMounted } from 'vue';
|
import { ref,reactive, onMounted,watch } from 'vue';
|
||||||
import { getGroupClaList, setGroupClaStatus, deleteGroupCla } from '@/api/cla';
|
import { getGroupClaList, setGroupClaStatus, deleteGroupCla } from '@/api/cla';
|
||||||
import { useRouter, useRoute } from 'vue-router';
|
import { useRouter, useRoute } from 'vue-router';
|
||||||
import { GModal } from '@/components/Setting/index';
|
import { GModal } from '@/components/Setting/index';
|
||||||
@@ -322,6 +322,18 @@ onMounted(() => {
|
|||||||
...query
|
...query
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 监听路由变化,更新 searchWord
|
||||||
|
watch(
|
||||||
|
() => route.query.searchWord, // 监听路由的 searchWord 参数
|
||||||
|
(newSearchWord) => {
|
||||||
|
if (newSearchWord) {
|
||||||
|
newFormData.value.searchWord = newSearchWord; // 更新组件的 searchWord
|
||||||
|
getReleaseList(); // 重新调用接口
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true } // 立即执行一次
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
Reference in New Issue
Block a user