From fdb6a4f5005fc853adfe8498efba66870a3fa750 Mon Sep 17 00:00:00 2001 From: akhuoa Date: Fri, 29 Nov 2024 10:36:47 +1300 Subject: [PATCH] Change search history from select to dropdown --- src/components.d.ts | 6 +++ src/components/SearchHistory.vue | 81 +++++++++++++++++++++++++++++++- 2 files changed, 86 insertions(+), 1 deletion(-) diff --git a/src/components.d.ts b/src/components.d.ts index ada51bc3..218b9a14 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -16,10 +16,16 @@ declare module 'vue' { ElCascader: typeof import('element-plus/es')['ElCascader'] ElCol: typeof import('element-plus/es')['ElCol'] ElDrawer: typeof import('element-plus/es')['ElDrawer'] + ElDropdown: typeof import('element-plus/es')['ElDropdown'] + ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem'] + ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu'] ElIcon: typeof import('element-plus/es')['ElIcon'] + ElIconArrowDown: typeof import('@element-plus/icons-vue')['ArrowDown'] ElIconArrowLeft: typeof import('@element-plus/icons-vue')['ArrowLeft'] ElIconArrowRight: typeof import('@element-plus/icons-vue')['ArrowRight'] + ElIconDelete: typeof import('@element-plus/icons-vue')['Delete'] ElIconLocation: typeof import('@element-plus/icons-vue')['Location'] + ElIconStar: typeof import('@element-plus/icons-vue')['Star'] ElIconWarning: typeof import('@element-plus/icons-vue')['Warning'] ElIconWarnTriangleFilled: typeof import('@element-plus/icons-vue')['WarnTriangleFilled'] ElInput: typeof import('element-plus/es')['ElInput'] diff --git a/src/components/SearchHistory.vue b/src/components/SearchHistory.vue index ab220ba4..d4a202e9 100644 --- a/src/components/SearchHistory.vue +++ b/src/components/SearchHistory.vue @@ -27,7 +27,45 @@ @@ -137,6 +175,12 @@ export default { } return label; }, + addToSavedSearch: function (item) { + item.saved = true; + }, + removeFromSavedSearch: function (item) { + // remove + }, }, mounted: function () { this.getSearchHistory() @@ -227,6 +271,21 @@ export default { } } } + +:deep(.el-dropdown-menu__item) { + justify-content: space-between; + cursor: default; + + &:hover, + &:active { + color: inherit; + background-color: var(--el-bg-color-page); + } + + i { + margin: 0; + } +}