Allow delete single history item

This commit is contained in:
the1812 2019-08-26 15:44:27 +08:00
parent 657e9272f1
commit cb06d32753
6 changed files with 14 additions and 9 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1161,6 +1161,7 @@ li.nav-item[report-id='playpage_dynamic'] .i-frame,
}
.custom-navbar em.suggest-highlight {
color: var(--theme-color);
font-style: normal;
}
.custom-navbar .search-list-item {
padding: 6px;

View File

@ -680,7 +680,7 @@ class SearchBox extends NavbarComponent {
</button>
</form>
<div class="popup search-list" :class="{empty: items.length === 0}">
<div class="search-list-item" tabindex="0" v-for="(item, index) of items" v-html="item.html" @keydown.enter="submit(item.value)" @click.self="submit(item.value)" @keydown.down.prevent="nextItem(index)" @keydown.up.prevent="previousItem(index)"></div>
<div class="search-list-item" tabindex="0" v-for="(item, index) of items" v-html="item.html" @keydown.enter="submit(item.value)" @click.self="submit(item.value)" @keydown.shift.delete="deleteItem(item, index)" @keydown.down.prevent="nextItem(index)" @keydown.up.prevent="previousItem(index)"></div>
<div tabindex="0" v-if="items.length > 0 && isHistory" class="search-list-item clear-history" @click="clearSearchHistory()" @keydown.enter="clearSearchHistory()" @keydown.down.prevent="nextItem(items.length)" @keydown.up.prevent="previousItem(items.length)"><i class="mdi mdi-18px mdi-delete-sweep"></i></div>
</div>
`;
@ -758,6 +758,10 @@ class SearchBox extends NavbarComponent {
return
}
},
deleteItem (item, index) {
settings.searchHistory = settings.searchHistory.splice(settings.searchHistory.findIndex(it => it.keyword === item.value), 1)
this.items.splice(index, 1)
},
clearSearchHistory () {
settings.searchHistory = []
this.items = []