mirror of
https://github.com/taigrr/homer
synced 2025-01-18 04:53:12 -08:00
chore: merges tagJump
This commit is contained in:
commit
af9037991b
32
src/App.vue
32
src/App.vue
@ -41,6 +41,7 @@
|
||||
<SearchInput
|
||||
class="navbar-item is-inline-block-mobile"
|
||||
@input="filterServices"
|
||||
:value="filter"
|
||||
@search-focus="showMenu = true"
|
||||
@search-open="navigateToFirstService"
|
||||
@search-cancel="filterServices"
|
||||
@ -69,6 +70,7 @@
|
||||
v-for="item in group.items"
|
||||
:key="item.name"
|
||||
v-bind:item="item"
|
||||
@filter="filterTag"
|
||||
:class="['column', `is-${12 / config.columns}`]"
|
||||
/>
|
||||
</template>
|
||||
@ -91,6 +93,7 @@
|
||||
<Service
|
||||
v-for="item in group.items"
|
||||
v-bind:item="item"
|
||||
@filter="filterTag"
|
||||
:key="item.url"
|
||||
/>
|
||||
</div>
|
||||
@ -213,6 +216,35 @@ export default {
|
||||
console.warning("fail to open service");
|
||||
}
|
||||
},
|
||||
filterTag: function (filter) {
|
||||
this.showMenu = true;
|
||||
this.$nextTick(() => {
|
||||
document.getElementById("searchBox").focus();
|
||||
});
|
||||
this.filter = filter;
|
||||
|
||||
if (!filter) {
|
||||
this.services = this.config.services;
|
||||
return;
|
||||
}
|
||||
|
||||
const searchResultItems = [];
|
||||
for (const group of this.config.services) {
|
||||
for (const item of group.items) {
|
||||
if (this.matchesFilter(item)) {
|
||||
searchResultItems.push(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.services = [
|
||||
{
|
||||
name: filter,
|
||||
icon: "fas fa-search",
|
||||
items: searchResultItems,
|
||||
},
|
||||
];
|
||||
},
|
||||
filterServices: function (filter) {
|
||||
this.filter = filter;
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
<div class="search-bar">
|
||||
<label for="search" class="search-label"></label>
|
||||
<input
|
||||
id="searchBox"
|
||||
type="text"
|
||||
ref="search"
|
||||
:value="value"
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<component v-bind:is="component" :item="item"></component>
|
||||
<component v-on="$listeners" v-bind:is="component" :item="item"></component>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -50,7 +50,12 @@ export default {};
|
||||
<i class="fas fa-info-circle"></i>
|
||||
</div>
|
||||
</a>
|
||||
<div class="tag" :class="item.tagstyle" v-if="item.tag">
|
||||
<div
|
||||
v-on:click="filterTag()"
|
||||
class="tag"
|
||||
:class="item.tagstyle"
|
||||
v-if="item.tag"
|
||||
>
|
||||
<strong class="tag-text">#{{ item.tag }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
@ -64,6 +69,11 @@ export default {
|
||||
props: {
|
||||
item: Object,
|
||||
},
|
||||
methods: {
|
||||
filterTag: function () {
|
||||
this.$emit("filter", this.item.tag.toLowerCase());
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -22,7 +22,12 @@
|
||||
{{ status.status }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="tag" :class="item.tagstyle" v-if="item.tag">
|
||||
<div
|
||||
v-on:click="filterTag()"
|
||||
class="tag"
|
||||
:class="item.tagstyle"
|
||||
v-if="item.tag"
|
||||
>
|
||||
<strong class="tag-text">#{{ item.tag }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
@ -51,6 +56,9 @@ export default {
|
||||
response.json()
|
||||
);
|
||||
},
|
||||
filterTag: function () {
|
||||
this.$emit("filter", this.item.tag.toLowerCase());
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user