Files
aurora-admin/frameworks/segmented.html
T

51 lines
2.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Aurora Admin · Segmented (H5)</title>
<link rel="stylesheet" href="../.design_library/aurora-admin/colors_and_type.css">
<style>
/* 对齐 组件2.txt Segmented 规范:高32px、选项内边距8px 16px、容器 #F5F7FA、圆角4px、选中白底、禁用 #BFBFBF */
.demo { padding: 24px; background: #F5F7FA; color: #262626; font-family: var(--font-family); }
h1 { font-size: 20px; margin: 0 0 4px; }
.sub { color: #8C8C8C; margin: 0 0 24px; font-size: 12px; }
.aa-segmented {
display: inline-flex; align-items: center; background: #F5F7FA; border-radius: 4px; padding: 2px;
}
.aa-segmented-item {
height: 28px; padding: 0 16px; display: inline-flex; align-items: center; gap: 6px;
border-radius: 4px; cursor: pointer; font-size: 14px; color: #262626; border: none; background: none;
transition: background .15s, color .15s;
}
.aa-segmented-item:hover:not(.is-active):not(.is-disabled) { color: #2F54EB; }
.aa-segmented-item.is-active { background: #fff; color: #262626; box-shadow: 0 1px 2px rgba(0,0,0,0.08); font-weight: 500; }
.aa-segmented-item.is-disabled { color: #BFBFBF; cursor: not-allowed; }
</style>
</head>
<body>
<div class="demo">
<h1>Aurora Admin · Segmented 组件(纯 H5)</h1>
<p class="sub">对齐 Segmented 规范:高32px、选项内边距8px 16px、容器 #F5F7FA、圆角4px、选中白底、禁用 #BFBFBF</p>
<div class="aa-segmented" id="seg">
<button class="aa-segmented-item is-active" data-val="list">列表</button>
<button class="aa-segmented-item" data-val="kanban">看板</button>
<button class="aa-segmented-item" data-val="gantt">甘特图</button>
<button class="aa-segmented-item is-disabled" data-val="cal" disabled>日历</button>
</div>
</div>
<script>
const seg = document.getElementById('seg');
seg.addEventListener('click', (e) => {
const btn = e.target.closest('.aa-segmented-item');
if (!btn || btn.disabled) return;
seg.querySelectorAll('.aa-segmented-item').forEach(b => b.classList.remove('is-active'));
btn.classList.add('is-active');
});
</script>
</body>
</html>