mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 07:28:37 +08:00
feat: optimize search bar UI with responsive capsule trigger and mobile-friendly dialog footer
This commit is contained in:
@@ -660,8 +660,9 @@ onMounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 底部快捷键提示 -->
|
<!-- 底部区域 -->
|
||||||
<div class="search-footer">
|
<!-- 桌面端:快捷键提示 -->
|
||||||
|
<div v-if="display.mdAndUp.value" class="search-footer">
|
||||||
<div class="shortcut-group">
|
<div class="shortcut-group">
|
||||||
<kbd>Esc</kbd>
|
<kbd>Esc</kbd>
|
||||||
<span class="shortcut-label">{{ t('dialog.searchBar.escClose') }}</span>
|
<span class="shortcut-label">{{ t('dialog.searchBar.escClose') }}</span>
|
||||||
@@ -671,6 +672,12 @@ onMounted(() => {
|
|||||||
<span class="shortcut-label">{{ t('dialog.searchBar.openSearch') }}</span>
|
<span class="shortcut-label">{{ t('dialog.searchBar.openSearch') }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 移动端:关闭图标 -->
|
||||||
|
<div v-else class="search-footer-mobile">
|
||||||
|
<VBtn icon variant="tonal" @click="emit('close')">
|
||||||
|
<VIcon icon="mdi-close" size="20" />
|
||||||
|
</VBtn>
|
||||||
|
</div>
|
||||||
</VCard>
|
</VCard>
|
||||||
</VDialog>
|
</VDialog>
|
||||||
|
|
||||||
@@ -688,7 +695,9 @@ onMounted(() => {
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.search-dialog {
|
.search-dialog {
|
||||||
|
display: flex;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
flex-direction: column;
|
||||||
border-radius: 16px !important;
|
border-radius: 16px !important;
|
||||||
box-shadow: 0 12px 40px rgba(0, 0, 0, 12%) !important;
|
box-shadow: 0 12px 40px rgba(0, 0, 0, 12%) !important;
|
||||||
}
|
}
|
||||||
@@ -845,6 +854,15 @@ kbd {
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 移动端底部关闭图标 */
|
||||||
|
.search-footer-mobile {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
margin-block-start: auto;
|
||||||
|
padding-block: 12px;
|
||||||
|
padding-block-end: calc(12px + env(safe-area-inset-bottom));
|
||||||
|
}
|
||||||
|
|
||||||
/* 响应式 */
|
/* 响应式 */
|
||||||
@media (width <= 600px) {
|
@media (width <= 600px) {
|
||||||
.search-header {
|
.search-header {
|
||||||
|
|||||||
@@ -27,25 +27,66 @@ const metaKey = computed(() => (isMac() ? '⌘+K' : 'Ctrl+K'))
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<!-- 👉 Search Icon -->
|
<!-- 小屏:仅图标按钮 -->
|
||||||
<div class="d-flex align-center cursor-pointer ms-lg-n2" style="user-select: none">
|
<IconBtn v-if="!display.mdAndUp.value" @click="openSearchDialog">
|
||||||
<IconBtn @click="openSearchDialog">
|
<VIcon icon="mdi-magnify" />
|
||||||
<VIcon icon="ri-search-line" />
|
</IconBtn>
|
||||||
</IconBtn>
|
|
||||||
<span v-if="display.lgAndUp.value" class="flex align-center text-disabled ms-2" @click="openSearchDialog">
|
<!-- 中屏及以上:胶囊搜索触发栏 -->
|
||||||
<span class="me-3">{{ t('common.search') }}</span>
|
<div v-else class="search-trigger" @click="openSearchDialog">
|
||||||
<span class="meta-key">{{ metaKey }}</span>
|
<VIcon icon="mdi-magnify" size="18" class="search-trigger-icon" />
|
||||||
</span>
|
<span class="search-trigger-text">{{ t('common.search') }}</span>
|
||||||
|
<kbd class="search-trigger-kbd">{{ metaKey }}</kbd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 搜索弹窗 -->
|
<!-- 搜索弹窗 -->
|
||||||
<SearchBarDialog v-model="searchDialog" v-if="searchDialog" @close="searchDialog = false" />
|
<SearchBarDialog v-model="searchDialog" v-if="searchDialog" @close="searchDialog = false" />
|
||||||
</template>
|
</template>
|
||||||
<style type="scss" scoped>
|
|
||||||
.meta-key {
|
<style scoped>
|
||||||
border: thin solid rgba(var(--v-border-color), var(--v-border-opacity));
|
.search-trigger {
|
||||||
border-radius: 6px;
|
display: flex;
|
||||||
block-size: 1.75rem;
|
align-items: center;
|
||||||
padding-block: 0.1rem;
|
gap: 8px;
|
||||||
padding-inline: 0.25rem;
|
border: 1.5px solid rgba(var(--v-theme-on-surface), 0.12);
|
||||||
|
border-radius: 22px;
|
||||||
|
background-color: rgba(var(--v-theme-on-surface), 0.03);
|
||||||
|
block-size: 36px;
|
||||||
|
cursor: pointer;
|
||||||
|
padding-inline: 12px;
|
||||||
|
transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-trigger:hover {
|
||||||
|
border-color: rgba(var(--v-theme-on-surface), 0.22);
|
||||||
|
background-color: rgba(var(--v-theme-on-surface), 0.06);
|
||||||
|
box-shadow: 0 1px 4px rgba(0, 0, 0, 4%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-trigger-icon {
|
||||||
|
color: rgba(var(--v-theme-on-surface), 0.4);
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-trigger-text {
|
||||||
|
color: rgba(var(--v-theme-on-surface), 0.4);
|
||||||
|
font-size: 13.5px;
|
||||||
|
line-height: 1;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-trigger-kbd {
|
||||||
|
border: 1px solid rgba(var(--v-theme-on-surface), 0.12);
|
||||||
|
border-radius: 5px;
|
||||||
|
background-color: rgba(var(--v-theme-on-surface), 0.04);
|
||||||
|
color: rgba(var(--v-theme-on-surface), 0.4);
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 1;
|
||||||
|
margin-inline-start: 4px;
|
||||||
|
padding-block: 3px;
|
||||||
|
padding-inline: 5px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user