fix(works): 头像选型取消 10 张上限,改为不限数量多选
- works/avatar-picker.html:移除 LIMIT 常量与上限拦截,底部显示「已选 N 张」,头部文案改为「自由多选(不限数量)」 - works.js:索引 desc/stats 同步(选择=不限),file 加 ?v= 破缓存 - works.html:works.js 引用 bump 到 20261115c
This commit is contained in:
@@ -33,7 +33,7 @@ footer{position:fixed;left:0;right:0;bottom:0;background:#fff;border-top:1px sol
|
||||
.btn.ghost{background:#F1F3F8;color:#555}
|
||||
.tip{font-size:12px;color:var(--muted);margin:0 0 14px}
|
||||
</style></head><body>
|
||||
<header><h1>默认头像选型 · 线条人像</h1><div class="sub">点击卡片选中(最多 10 张),底部可复制清单发我。全部为线条/描边风格人物图标,共 10 个图标库。素材来源:画个标素材 API</div>
|
||||
<header><h1>默认头像选型 · 线条人像</h1><div class="sub">点击卡片自由多选(不限数量),底部可复制清单发我。全部为线条/描边风格人物图标,共 10 个图标库。素材来源:画个标素材 API</div>
|
||||
<div class="tabs"><button class="tab active" data-filter="all">全部</button>
|
||||
<button class="tab" data-filter="lucide">Lucide</button>
|
||||
<button class="tab" data-filter="tabler">Tabler</button>
|
||||
@@ -115,7 +115,6 @@ footer{position:fixed;left:0;right:0;bottom:0;background:#fff;border-top:1px sol
|
||||
<button class="btn primary" id="copy">复制清单</button>
|
||||
</footer>
|
||||
<script>
|
||||
const LIMIT = 10;
|
||||
const KEY = 'dm_avatar_pick_line_v1';
|
||||
const cards = Array.from(document.querySelectorAll('.card'));
|
||||
let picked = JSON.parse(localStorage.getItem(KEY) || '[]');
|
||||
@@ -123,16 +122,13 @@ let picked = JSON.parse(localStorage.getItem(KEY) || '[]');
|
||||
function render() {
|
||||
cards.forEach(c => c.classList.toggle('sel', picked.includes(c.dataset.ref)));
|
||||
const el = document.getElementById('picked');
|
||||
if (!picked.length) { el.innerHTML = '尚未选择 · 已选 <b>0</b>/' + LIMIT; return; }
|
||||
el.innerHTML = '已选 <b>' + picked.length + '</b>/' + LIMIT + ':' + picked.join('、');
|
||||
if (!picked.length) { el.innerHTML = '尚未选择 · 已选 <b>0</b> 张'; return; }
|
||||
el.innerHTML = '已选 <b>' + picked.length + '</b> 张:' + picked.join('、');
|
||||
}
|
||||
function toggle(ref) {
|
||||
const i = picked.indexOf(ref);
|
||||
if (i >= 0) picked.splice(i, 1);
|
||||
else {
|
||||
if (picked.length >= LIMIT) { alert('最多选 ' + LIMIT + ' 张,先取消一张再选'); return; }
|
||||
picked.push(ref);
|
||||
}
|
||||
else picked.push(ref);
|
||||
localStorage.setItem(KEY, JSON.stringify(picked));
|
||||
render();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user