forked from geolba/tethys.frontend
- feature request: autocomplete search also on the start page and on the dataset detail page
This commit is contained in:
parent
1239bb9df3
commit
3bd022bf54
10 changed files with 612 additions and 524 deletions
|
|
@ -1,11 +1,27 @@
|
|||
import { Options, Vue } from "vue-class-component";
|
||||
import VsInput from "@/components/vs-input/vs-input.vue";
|
||||
import { Suggestion } from "@/models/dataset";
|
||||
|
||||
@Options({
|
||||
name: "HomeViewComponent",
|
||||
components: {
|
||||
VsInput,
|
||||
},
|
||||
})
|
||||
export default class HomeViewComponent extends Vue {
|
||||
public display = "";
|
||||
|
||||
onSearch(suggestion: Suggestion | string): void {
|
||||
let term;
|
||||
if (typeof suggestion === "string") {
|
||||
term = suggestion;
|
||||
this.$router.push({ name: "Search", params: { display: term } });
|
||||
} else if (suggestion instanceof Suggestion) {
|
||||
term = suggestion.value;
|
||||
this.$router.push({ name: "Search", params: { display: term, type: suggestion.type } });
|
||||
}
|
||||
}
|
||||
|
||||
search(): void {
|
||||
this.$router.push({ name: "Search", params: { display: this.display } });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue