u
This commit is contained in:
1 parent
8f3f6982db
commit
5a79414319
10 files changed
+355
-293
No files matched your search
+76
-132
@@ -1,147 +1,91 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Bottom Nav Demo</title>
|
||||
<link rel="stylesheet" href="style.css" />
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>全局底部导航 Demo</title>
|
||||
<style>
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: system-ui, -apple-system, BlinkMacSystemFont;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: sans-serif;
|
||||
background-color: #f0f2f5;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: flex-end;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #f6f7f9;
|
||||
height: 100vh;
|
||||
}
|
||||
/* 弹出面板 */
|
||||
.bottom-panel {
|
||||
width: 100%;
|
||||
max-width: 400px;
|
||||
background: white;
|
||||
border-top-left-radius: 20px;
|
||||
border-top-right-radius: 20px;
|
||||
padding: 16px;
|
||||
box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 16px;
|
||||
padding-bottom: 80px;
|
||||
color: #555;
|
||||
}
|
||||
/* 每个导航 item */
|
||||
.nav-item {
|
||||
background: #f9f9f9;
|
||||
border-radius: 16px;
|
||||
padding: 16px 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
transition: transform 0.2s, background 0.2s;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* 底部栏 */
|
||||
.bottom-bar {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 56px;
|
||||
background: #fff;
|
||||
border-top: 1px solid #e5e5e5;
|
||||
.nav-item:hover {
|
||||
background: #e0e0ff;
|
||||
transform: translateY(-3px) scale(1.05);
|
||||
}
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
padding: 0 12px;
|
||||
}
|
||||
|
||||
/* 左右按钮 */
|
||||
.nav-btn {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border: none;
|
||||
background: none;
|
||||
font-size: 18px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* 中间区域 */
|
||||
.nav-center {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #222;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.nav-center .arrow {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* 扩展菜单 */
|
||||
.extension {
|
||||
position: fixed;
|
||||
bottom: 56px;
|
||||
left: 12px;
|
||||
right: 12px;
|
||||
|
||||
background: #fff;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 8px 24px rgba(0,0,0,0.08);
|
||||
|
||||
transform: translateY(20px);
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.extension.show {
|
||||
transform: translateY(0);
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.extension-item {
|
||||
padding: 14px 16px;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.extension-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.extension-item.danger {
|
||||
color: #d93026;
|
||||
}
|
||||
.nav-icon {
|
||||
font-size: 28px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.nav-name {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<main class="content">
|
||||
<p>当前工具内容区域</p>
|
||||
</main>
|
||||
|
||||
<!-- 扩展菜单 -->
|
||||
<div class="extension" id="extension">
|
||||
<div class="extension-item">视图切换</div>
|
||||
<div class="extension-item">工具设置</div>
|
||||
<div class="extension-item">导出数据</div>
|
||||
<div class="extension-item danger">清空记录</div>
|
||||
<div class="bottom-panel">
|
||||
<div class="nav-item" onclick="alert('跳转到首页')">
|
||||
<div class="nav-icon">🏠</div>
|
||||
<div class="nav-name">首页</div>
|
||||
</div>
|
||||
<div class="nav-item" onclick="alert('跳转到记账')">
|
||||
<div class="nav-icon">📝</div>
|
||||
<div class="nav-name">记账</div>
|
||||
</div>
|
||||
<div class="nav-item" onclick="alert('跳转到分类')">
|
||||
<div class="nav-icon">📂</div>
|
||||
<div class="nav-name">分类</div>
|
||||
</div>
|
||||
<div class="nav-item" onclick="alert('跳转到分析')">
|
||||
<div class="nav-icon">📊</div>
|
||||
<div class="nav-name">分析</div>
|
||||
</div>
|
||||
<div class="nav-item" onclick="alert('跳转到设置')">
|
||||
<div class="nav-icon">⚙️</div>
|
||||
<div class="nav-name">设置</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 底部导航 -->
|
||||
<nav class="bottom-bar">
|
||||
<button class="nav-btn">←</button>
|
||||
|
||||
<div class="nav-center">
|
||||
<span class="title">记账 · 本月</span>
|
||||
<span class="arrow">▾</span>
|
||||
</div>
|
||||
|
||||
<button class="nav-btn" onclick="toggleExt()">⋯</button>
|
||||
</nav>
|
||||
|
||||
<script>
|
||||
function toggleExt() {
|
||||
document.getElementById('extension')
|
||||
.classList.toggle('show')
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</html>
|
||||
Reference in new issue
Block a user