предварительный коммит

- сделала панель навигации
This commit is contained in:
alisagerasimova
2026-02-25 21:17:21 +03:00
parent dffde0e4f5
commit 7b51b59b40
2 changed files with 101 additions and 31 deletions
+1 -1
View File
@@ -123,7 +123,7 @@ function copyAndToast(text) {
<button @click="cleanResult">Очистить</button> <button @click="cleanResult">Очистить</button>
<button @click="cleanResult">Отменить</button> <button @click="cleanResult">Отменить</button>
</div> </div>
<!-- <MyDropMenu/> --> <MyDropMenu/>
</div> </div>
+100 -30
View File
@@ -1,11 +1,37 @@
<template> <template>
<div class="dropdown"> <div class="navigation-wrapper">
<button @click="toggleDropdown"> Меню</button> <!-- Кнопка Бургер -->
<ul v-show="isOpen" class="dropdown-menu-left"> <button
<li><a href="#">Пункт 1</a></li> class="burger-btn"
<li><a href="#">Пункт 2</a></li> @click="toggleMenu"
<li><a href="#">Пункт 3</a></li> :class="{ 'is-active': isOpen }"
</ul> aria-label="Menu"
>
<span class="line"></span>
<span class="line"></span>
<span class="line"></span>
</button>
<!-- Затемнение заднего фона (Overlay) -->
<transition name="fade">
<div v-if="isOpen" class="overlay" @click="closeMenu"></div>
</transition>
<!-- Выпадающая панель -->
<transition name="slide">
<aside v-if="isOpen" class="side-panel">
<div class="menu-header">
<h3>Навигация</h3>
</div>
<nav class="menu-content">
<a href="https://clover.coex.tech/ru/simple_offboard.html" target="_blank">COEX Автономный полет</a>
<slot>
<p class="placeholder">Здесь будут ваши ссылки...</p>
</slot>
</nav>
</aside>
</transition>
</div> </div>
</template> </template>
@@ -14,35 +40,79 @@ import { ref } from 'vue';
const isOpen = ref(false); const isOpen = ref(false);
function toggleDropdown() { const toggleMenu = () => {
isOpen.value = !isOpen.value; isOpen.value = !isOpen.value;
} };
const closeMenu = () => {
isOpen.value = false;
};
// Экспортируем методы, если захотим управлять меню извне
defineExpose({ open: () => (isOpen.value = true), close: closeMenu });
</script> </script>
<style> <style scoped>
.dropdown-menu-left { .burger-btn {
position: absolute; position: fixed; /* Она всегда на одном месте при скролле */
top: 20px;
left: 20px;
z-index: 9999; /* Максимальный приоритет, чтобы быть ПОВЕРХ всего */
display: flex;
flex-direction: column;
justify-content: space-around;
width: 40px;
height: 30px;
background: rgba(255, 255, 255, 0.508);
border: 1px solid #383838;
cursor: pointer;
padding: 5px;
}
.line {
width: 100%;
height: 4px;
background-color: #383838; /* Ярко-красный цвет для теста */
transition: all 0.3s ease;
}
/* Анимация бургера в крестик */
.is-active .line:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.is-active .line:nth-child(2) { opacity: 0; }
.is-active .line:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }
/* Боковая панель */
.side-panel {
position: fixed;
top: 0;
left: 0; left: 0;
top: 100%; width: 300px;
background: #fff; height: 100vh;
border: 1px solid #ccc; background: white;
list-style: none; z-index: 1000;
padding: 0; padding: 80px 20px 20px;
margin: 0;
min-width: 150px;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
transform: translateX(-100%);
transition: transform 0.3s ease;
} }
.dropdown-menu-left li a { /* Затемнение фона */
display: block; .overlay {
padding: 10px 15px; position: fixed;
text-decoration: none; top: 0;
color: #333; left: 0;
width: 100vw;
height: 100vh;
z-index: 999;
} }
.dropdown-menu-left li a:hover { /* Анимации появления */
background: #f0f0f0; .slide-enter-active, .slide-leave-active { transition: transform 0.3s ease; }
.slide-enter-from, .slide-leave-to { transform: translateX(-100%); }
.fade-enter-active, .fade-leave-active { transition: opacity 0.3s ease; }
.fade-enter-from, .fade-leave-to { opacity: 0; }
.placeholder {
color: #00e44c;
/* цвет текста */
font-style: italic;
} }
</style> </style>