Files
aurora-admin/site/sources/topmenu/html.txt
T
aurora-admin c65a69c34e
Deploy to GitHub Pages / deploy (push) Failing after 16s
Regression / regression (push) Failing after 15m2s
feat(P4): precompute移植+app.js sources双向回填+回归1003/1003+验收体积/文件/data.json
2026-09-12 14:18:41 +08:00

56 lines
2.2 KiB
Plaintext
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 · TopMenu(普通 H5)</title>
<link rel="stylesheet" href="../.design_library/aurora-admin/colors_and_type.css" />
<link rel="stylesheet" href="TopMenu.css" />
</head>
<body>
<div class="aa-topmenu" role="navigation" id="app"></div>
<script>
var DATA = [
{ label: '工作台', key: 'home' },
{ label: '订单', key: 'order', badge: '3', children: [
{ label: '全部订单', key: 'order-all' },
{ label: '待发货', key: 'order-ship' },
{ label: '退款', key: 'order-refund' }
] },
{ label: '商品', key: 'goods', children: [
{ label: '商品列表', key: 'goods-list' },
{ label: '分类管理', key: 'goods-cat' }
] },
{ label: '数据', key: 'data' },
{ label: '设置', key: 'setting' }
];
var active = 'order-all';
function render() {
var root = document.getElementById('app');
root.innerHTML = DATA.map(function (it) {
var subs = (it.children || []).map(function (s) {
return '<a class="aa-topmenu-sub ' + (s.key === active ? 'is-active' : '') + '" role="navigation" data-key="' + s.key + '">' + s.label + '</a>';
}).join('');
var dropdown = it.children ? '<div class="aa-topmenu-dropdown" role="navigation">' + subs + '</div>' : '';
var badge = it.badge ? '<span class="aa-topmenu-badge">' + it.badge + '</span>' : '';
var caret = it.children ? '<span class="aa-topmenu-caret">▾</span>' : '';
var topActive = it.key === active || (it.children || []).some(function (s) { return s.key === active; });
return '<div class="aa-topmenu-item ' + (topActive ? 'is-active' : '') + '" role="menuitem" tabindex="0" data-key="' + it.key + '">' +
'<span>' + it.label + '</span>' + badge + caret + dropdown + '</div>';
}).join('');
root.querySelectorAll('[data-key]').forEach(function (el) {
el.addEventListener('click', function (e) {
e.stopPropagation();
active = el.dataset.key;
render();
});
});
}
render();
</script>
</body>
</html>