Skip to content

Commit

Permalink
fix(TargetDropDown): call change when component is initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
zjp-CN committed Nov 29, 2024
1 parent f408f2d commit 56f81b7
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions os-checks/components/TargetDropDown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,13 @@ const defaultTarget = "All-Targets";
const selected = ref(defaultTarget);
const targets = ref<string[]>([defaultTarget]);
const visible = ref(true);
const candidates = useBasicStore();
// 随路由页面变化而下载相应的 basic.json
const route = useRoute();
watch(() => [route.path, route.params], ([path, params]) => {
// console.log("path =", path);
if (path === "/" || path === "/repos" || path === "/charts" || path === "/target" || path === "/workflows") {
visible.value = false;
return;
} else if (params) {
// console.log("path =", path);
fetch();
}
visible.value = true;
});
change(route.path, route.params);
watch(() => [route.path, route.params], ([path, params]) => change(path as string, params));
const candidates = useBasicStore();
fetch();
watch(selected, (val) => candidates.update_current(val));
Expand All @@ -52,6 +43,17 @@ function fetch() {
});
}
function change(path: string, params: any) {
// console.log("path =", path);
if (path === "/" || path === "/repos" || path === "/charts" || path === "/target" || path === "/workflows") {
visible.value = false;
return;
} else if (params) {
// console.log("path =", path);
fetch();
}
visible.value = true;
}
</script>

<style scoped>
Expand Down

0 comments on commit 56f81b7

Please sign in to comment.