Files
aurora-admin/site/m/component/mobile-list.html
T
aurora-admin 5ee5d829a4
Regression / regression (push) Canceled after 0s
refactor(详情页+S8): 详情页减重(导航互斥/入口去重/i18n去重) + 品牌标识入库
本提交含两条并行工作线,因互相咬合(package.json scripts、regression.yml、
npm run build 链)无法按文件干净拆分,故合并为一次自洽提交。

## 详情页减重(本轮主任务:修复「AI 干太重」)

- 导航收敛:宽屏只用右侧目录、≤1200px 只用页内 sticky 导航,纯 CSS 媒体查询
  实现(不引入 JS 宽度监听)。此前两套导航同时可见,active 状态互相打架。
- 入口去重:标题区由「查看示例/在线测试/契约 JSON」三个减为「在线测试」一个;
  契约 JSON 归入实现资源;删除示例底部重复的「在线测试」。
- 示例工具栏:删除与目录锚点重复的示例下拉选择器;「全部展开代码」只在
  示例数 >1 时出现(103 个组件里 49 个仅 1 个示例,此前恒显示)。
- 重复文案:示例区两句同义导语合并为一句。
- 首页 CTA 由 5 个减为 2 个(浏览组件/快速开始),测试总览入口挂到已有的
  通过率统计卡上,不再另占 Hero 按钮。
- 统一详情取数:抽出 fetchDetail/loadDetail 作为 details/*.json 的唯一路径,
  FAQ 不再自行 fetch 一遍,与组件页共用缓存与失败兜底。

## i18n

- 删除 12 组重复键(含整段 FAQ 说明),字典 604 → 585 唯一键。
- 删除本次改动产生的 6 个死键。
- verify-i18n.mjs 新增 `unique dictionary keys` 断言:重复键在对象字面量里
  是静默的后值覆盖,此前无从发现;现由门禁拦住。

## 文档事实修正(实测为准)

- TESTING/CONTRIBUTING:79 → 103 组件;旧断言数改为回指 tests/report.json。
- PLATFORMS:移动端 108 文件/18 端 → 282 文件/47 端;契约 5 → 47;
  令牌 17 → 15;uni-app SFC 21 → 50。
- AGENTS:断言 1405/18 页 → 1464/103 页(PC)、807/47 页(移动端)。
- package.json:YOUR-ACCOUNT 占位 → gitea 实址与 kole-ui.mymoyu.top。

## 品牌标识(并行会话成果,一并入库)

- brand-mark.json 收归真源,build:brand 生成 favicon 与单色 SVG;
  PC 与移动端共用资产,verify:brand 24 条断言。
- regression.yml 增加 verify:brand 步骤。

## 门禁与验收

新增工具:verify-component-page.mjs(86 条真实浏览器断言,随详情页改造同步
更新为「只允许一套导航可见」)、verify-brand-mark.mjs、lib/i18n-dead-keys.mjs
(只读诊断)。

回归:PC 100%(1464/1464,103 页,N/A 50)· 移动端 100%(807/807,47 页)。
门禁:component-page 86 · i18n 17 · brand 24 · routes all · smoke all ·
theme OK · isolation 31 · nav all · examples 9 · api-docs 10 · mobile-docs 12。

已知未做:i18n 另有约 44 条历史死键(非本次产生),已记为 ROADMAP S8-P6;
顶栏与悬浮区的两个主题入口为刻意设计(verify-theme 断言其互斥),未删。
2026-09-22 23:56:05 +08:00

1959 lines
103 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">
<script>
(function () {
var m = 'auto';
try { var v = localStorage.getItem('kole-mode'); if (v === 'light' || v === 'dark' || v === 'auto') m = v; } catch (e) {}
var dark = m === 'dark' || (m === 'auto' && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches);
document.documentElement.classList.toggle('kole-dark', !!dark);
document.documentElement.style.colorScheme = dark ? 'dark' : 'light';
})();
</script>
<link rel="icon" href="../../assets/kole-mark.svg">
<meta name="theme-color" content="#FFFFFF" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#1C1F26" media="(prefers-color-scheme: dark)">
<title>列表 List — Kole UI Mobile</title>
<meta name="description" content="列表 List:移动端组件(6 端实现:CSS / H5 原生 / React / Vue 2 / Vue 3 / uni-app)。与 PC 端物理隔离:类名 kole-m-、令牌 --kole-m-。规格来源:移动端规格 24 · 列表 List。">
<link rel="stylesheet" href="../../../.design_library/kole-ui-mobile/colors_and_type.css">
<link rel="stylesheet" href="../style.css">
</head>
<body>
<header class="m-top">
<div class="m-top-inner">
<a class="m-logo" href="../index.html">
<span class="m-logo-mark" data-brand-mark="mono" aria-hidden="true"></span>
<span class="m-logo-text">Kole UI<em>移动端</em></span>
</a>
<div class="m-ver-picker" id="m-ver-picker">
<button id="m-ver-trigger" class="m-ver-trigger" type="button" data-single="1" aria-haspopup="listbox" aria-expanded="false" aria-label="选择版本" title="文档版本(清单来自部署根的 versions.json)">
<span id="m-ver">v1.0.0</span>
<svg class="m-ver-caret" width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg>
</button>
<div id="m-ver-menu" class="m-ver-menu hidden" role="listbox" aria-label="文档版本">
<div class="m-ver-menu-head" id="m-ver-head">文档版本</div>
</div>
</div>
<nav class="m-nav"> <a href="../index.html" class="active" aria-current="page">组件总览</a>
<a href="../guide.html">快速开始</a>
<a href="../design.html">设计规范</a>
<a href="../faq.html">常见问题</a>
<a href="../changelog.html">更新日志</a></nav>
<div class="m-mode">
<button id="m-mode-trigger" class="m-mode-trigger" type="button" aria-haspopup="listbox" aria-expanded="false" aria-label="主题模式" title="主题模式">
<svg class="m-mode-icon" id="m-icon-moon" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>
<svg class="m-mode-icon" id="m-icon-sun" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" style="display:none"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"/></svg>
<svg class="m-mode-icon" id="m-icon-auto" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" style="display:none"><rect x="3" y="4" width="18" height="13" rx="2"/><path d="M8 21h8M12 17v4"/></svg>
<span id="m-mode-cur">自动模式</span>
<svg class="m-mode-caret" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg>
</button>
<div id="m-mode-menu" class="m-menu hidden" role="listbox" aria-label="主题模式">
<div class="m-menu-head">主题模式</div>
<button class="m-menu-opt" type="button" role="option" data-mode="light" aria-selected="false"><span data-mode-label="light">日间模式</span></button>
<button class="m-menu-opt" type="button" role="option" data-mode="dark" aria-selected="false"><span data-mode-label="dark">夜间模式</span></button>
<button class="m-menu-opt" type="button" role="option" data-mode="auto" aria-selected="true"><span data-mode-label="auto">自动模式</span></button>
</div>
</div>
</div>
</header>
<div class="m-body">
<details class="m-side" open>
<summary><span>移动端导航</span><span class="cur">列表</span></summary>
<nav>
<div class="m-side-section"><span>平台</span></div>
<a class="m-side-link m-side-platform" href="../../index.html"><span class="sp-top"><span class="sp-name">PC 端组件</span></span><span class="sp-sub">103 个中后台组件 · 5 端</span></a>
<a class="m-side-link m-side-platform" href="../index.html"><span class="sp-top"><span class="sp-name">移动端组件</span><span class="sp-badge">当前</span></span><span class="sp-sub">47 个组件 · 6 端 · 含 uni-app</span></a>
<div class="m-side-section"><span>开发指南</span></div>
<a class="m-side-link" href="../index.html">组件总览</a>
<a class="m-side-link" href="../guide.html">快速开始</a>
<a class="m-side-link" href="../design.html">设计规范</a>
<a class="m-side-link" href="../faq.html">常见问题</a>
<a class="m-side-link" href="../changelog.html">更新日志</a>
<a class="m-side-link" href="../platform.html">平台与端<em>移动端</em></a>
<a class="m-side-link" href="../../../tests/mobile/index.html" target="_blank">测试与回归<em>移动端</em></a>
<div class="m-side-section"><span>组件</span><span class="cnt">47</span></div>
<div class="m-side-group"><span>通用</span><span class="cnt">5</span></div>
<a class="m-side-link" href="mobile-button.html">按钮<em>Button</em></a>
<a class="m-side-link" href="mobile-divider.html">分割线<em>Divider</em></a>
<a class="m-side-link" href="mobile-icon.html">图标<em>Icon</em></a>
<a class="m-side-link" href="mobile-layout.html">布局<em>Layout</em></a>
<a class="m-side-link" href="mobile-link.html">链接<em>Link</em></a>
<div class="m-side-group"><span>导航</span><span class="cnt">6</span></div>
<a class="m-side-link" href="navbar.html">顶部导航栏<em>NavBar</em></a>
<a class="m-side-link" href="tabbar.html">底部标签栏<em>TabBar</em></a>
<a class="m-side-link" href="mobile-grid.html">宫格<em>Grid</em></a>
<a class="m-side-link" href="mobile-steps.html">步骤条<em>Steps</em></a>
<a class="m-side-link" href="mobile-segmented.html">分段器<em>Segmented</em></a>
<a class="m-side-link" href="mobile-sticky.html">吸顶容器<em>Sticky</em></a>
<div class="m-side-group"><span>数据录入</span><span class="cnt">16</span></div>
<a class="m-side-link" href="mobile-numberkeyboard.html">数字键盘<em>NumberKeyboard</em></a>
<a class="m-side-link" href="mobile-datepicker.html">日期选择器<em>DatePicker</em></a>
<a class="m-side-link" href="mobile-input.html">输入框<em>Input</em></a>
<a class="m-side-link" href="mobile-search.html">搜索框<em>Search</em></a>
<a class="m-side-link" href="mobile-stepper.html">步进器<em>Stepper</em></a>
<a class="m-side-link" href="mobile-switch.html">开关<em>Switch</em></a>
<a class="m-side-link" href="mobile-textarea.html">多行文本框<em>Textarea</em></a>
<a class="m-side-link" href="mobile-checkbox.html">多选框<em>Checkbox</em></a>
<a class="m-side-link" href="mobile-form.html">表单<em>Form</em></a>
<a class="m-side-link" href="mobile-radio.html">单选框<em>Radio</em></a>
<a class="m-side-link" href="mobile-rate.html">评分<em>Rate</em></a>
<a class="m-side-link" href="mobile-slider.html">滑动选择器<em>Slider</em></a>
<a class="m-side-link" href="mobile-cascader.html">级联选择器<em>Cascader</em></a>
<a class="m-side-link" href="mobile-colorpicker.html">颜色选择器<em>ColorPicker</em></a>
<a class="m-side-link" href="mobile-picker.html">选择器<em>Picker</em></a>
<a class="m-side-link" href="mobile-upload.html">上传<em>Upload</em></a>
<div class="m-side-group"><span>数据展示</span><span class="cnt">8</span></div>
<a class="m-side-link" href="cell.html">单元格<em>Cell</em></a>
<a class="m-side-link" href="mobile-badge.html">徽标<em>Badge</em></a>
<a class="m-side-link" href="mobile-tag.html">标签<em>Tag</em></a>
<a class="m-side-link" href="mobile-avatar.html">头像<em>Avatar</em></a>
<a class="m-side-link is-active" href="mobile-list.html" aria-current="page">列表<em>List</em></a>
<a class="m-side-link" href="mobile-collapse.html">折叠面板<em>Collapse</em></a>
<a class="m-side-link" href="mobile-table.html">表格<em>Table</em></a>
<a class="m-side-link" href="mobile-typography.html">排版<em>Typography</em></a>
<div class="m-side-group"><span>反馈</span><span class="cnt">12</span></div>
<a class="m-side-link" href="actionsheet.html">动作面板<em>ActionSheet</em></a>
<a class="m-side-link" href="pullrefresh.html">下拉刷新<em>PullRefresh</em></a>
<a class="m-side-link" href="swipecell.html">滑动单元格<em>SwipeCell</em></a>
<a class="m-side-link" href="mobile-popup.html">弹出层<em>Popup</em></a>
<a class="m-side-link" href="mobile-toast.html">轻提示<em>Toast</em></a>
<a class="m-side-link" href="mobile-dialog.html">对话框<em>Dialog</em></a>
<a class="m-side-link" href="mobile-noticebar.html">通知栏<em>NoticeBar</em></a>
<a class="m-side-link" href="mobile-loading.html">加载<em>Loading</em></a>
<a class="m-side-link" href="mobile-progress.html">进度条<em>Progress</em></a>
<a class="m-side-link" href="mobile-message.html">消息通知<em>Message</em></a>
<a class="m-side-link" href="mobile-overlay.html">遮罩层<em>Overlay</em></a>
<a class="m-side-link" href="mobile-popover.html">弹出气泡<em>Popover</em></a>
</nav>
</details>
<main class="m-main">
<section class="m-hero">
<h1>列表<span class="en" style="font-family: var(--kole-font-family-num); font-size: 14px; color: var(--kole-color-text-secondary); margin-left: 8px;">List</span></h1>
<p>把一组同类信息按行排列,用于「设置项 / 订单 / 成员」这类需要扫读的场合</p>
<p style="margin-top: 8px;" class="m-chips">
<span class="m-chip m">数据展示</span>
<span class="m-chip">规格 24 · 列表 List</span>
<span class="m-chip">6 端实现</span>
<span class="m-chip">触摸优先</span>
</p>
<div class="m-code" style="margin-top: var(--kole-space-12);">
<div class="m-code-head"><span>引入(H5 原生;其余 5 端见「快速开始」)</span><button class="m-copy" type="button" data-copy="code-import">复制</button></div>
<pre id="code-import"><code>&lt;!-- ① 令牌:PC 令牌 + 移动端 --kole-m-* 合成单文件,引一次 --&gt;
&lt;link rel=&quot;stylesheet&quot; href=&quot;kole-ui/mobile/tokens.css&quot;&gt;
&lt;!-- ② 本组件样式(全量则用 kole-ui/mobile/components/index.css) --&gt;
&lt;link rel=&quot;stylesheet&quot; href=&quot;kole-ui/mobile/components/mobile-list.css&quot;&gt;
&lt;!-- ③ 结构照抄下方任一演示块(类名与 6 端实现一致) --&gt;</code></pre>
</div>
</section>
<section class="m-block">
<h2 id="demo">演示</h2>
<p class="m-sub">每个演示都是真实渲染:预览帧加载 <code>frameworks-mobile/List.html?demo=&lt;id&gt;</code>(只显示该演示块),代码是该演示块在演示页里的原文,可复制。全部演示同屏可看 <a href="../../../frameworks-mobile/List.html" target="_blank">演示页 ↗</a>。</p>
<h3 class="m-demo-group">01 组件类型</h3>
<div class="m-demo" id="demo-basic">
<div class="m-demo-head"><span class="m-demo-title">基础列表</span><span class="m-chip">border=true / divider=inset</span></div>
<p class="m-demo-desc">标题 + 副标题 + 后缀位(值 + 箭头),行间 1px 分隔线且最后一条不画。</p>
<div class="m-demo-stage"><iframe src="../../../frameworks-mobile/List.html?demo=basic" title="列表 List · 基础列表" loading="lazy"></iframe></div>
<details class="m-details"><summary>查看代码(演示页原文 · 20 行)</summary>
<div class="m-code"><div class="m-code-head"><span>frameworks-mobile/List.html · basic</span><button class="m-copy" type="button" data-copy="code-demo-1">复制</button></div>
<pre id="code-demo-1"><code>&lt;section class=&quot;demo-block&quot; data-demo=&quot;basic&quot;&gt;
&lt;p class=&quot;demo-label&quot;&gt;基础列表(可点行整行热区 ≥56px,后缀位放值与箭头)&lt;/p&gt;
&lt;ul class=&quot;kole-m-list kole-m-list--border&quot; data-assert=&quot;list-basic&quot;&gt;
&lt;li class=&quot;kole-m-list__item&quot; data-assert=&quot;list-basic-row-1&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;
&lt;span class=&quot;kole-m-list__title&quot;&gt;待付款&lt;/span&gt;
&lt;span class=&quot;kole-m-list__desc&quot;&gt;共 2 笔,合计 ¥ 328.00&lt;/span&gt;
&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;kole-m-list__value&quot;&gt;去支付&lt;/span&gt;&lt;span class=&quot;kole-m-list__arrow&quot; aria-hidden=&quot;true&quot;&gt;›&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;&lt;span class=&quot;kole-m-list__title&quot;&gt;待收货&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;kole-m-list__value&quot;&gt;1 件&lt;/span&gt;&lt;span class=&quot;kole-m-list__arrow&quot; aria-hidden=&quot;true&quot;&gt;›&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;&lt;span class=&quot;kole-m-list__title&quot;&gt;退款/售后&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;kole-m-list__value&quot;&gt;无&lt;/span&gt;&lt;span class=&quot;kole-m-list__arrow&quot; aria-hidden=&quot;true&quot;&gt;›&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;</code></pre></div>
</details>
</div>
<div class="m-demo" id="demo-prefix">
<div class="m-demo-head"><span class="m-demo-title">带前缀位</span><span class="m-chip">anatomy.prefix</span></div>
<p class="m-demo-desc">前缀放头像、图标或序号;它是装饰,点击等于点整行。</p>
<div class="m-demo-stage"><iframe src="../../../frameworks-mobile/List.html?demo=prefix" title="列表 List · 带前缀位" loading="lazy"></iframe></div>
<details class="m-details"><summary>查看代码(演示页原文 · 21 行)</summary>
<div class="m-code"><div class="m-code-head"><span>frameworks-mobile/List.html · prefix</span><button class="m-copy" type="button" data-copy="code-demo-2">复制</button></div>
<pre id="code-demo-2"><code>&lt;section class=&quot;demo-block&quot; data-demo=&quot;prefix&quot;&gt;
&lt;p class=&quot;demo-label&quot;&gt;带前缀位(前缀是装饰,点击等于点整行)&lt;/p&gt;
&lt;ul class=&quot;kole-m-list kole-m-list--border&quot; data-assert=&quot;list-prefix&quot;&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__prefix&quot;&gt;&lt;span class=&quot;demo-dot&quot;&gt;王&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;
&lt;span class=&quot;kole-m-list__title&quot;&gt;王小明&lt;/span&gt;
&lt;span class=&quot;kole-m-list__desc&quot;&gt;产品设计部 · 交互设计师&lt;/span&gt;
&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;kole-m-list__value&quot;&gt;在职&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__prefix&quot;&gt;&lt;span class=&quot;demo-dot&quot;&gt;李&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;
&lt;span class=&quot;kole-m-list__title&quot;&gt;李小红&lt;/span&gt;
&lt;span class=&quot;kole-m-list__desc&quot;&gt;前端研发部 · 工程师&lt;/span&gt;
&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;kole-m-list__value&quot;&gt;休假&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;</code></pre></div>
</details>
</div>
<div class="m-demo" id="demo-custom">
<div class="m-demo-head"><span class="m-demo-title">自定义后缀</span><span class="m-chip">anatomy.suffix</span></div>
<p class="m-demo-desc">后缀位放标签这类非文字内容,与值文字共用一行。</p>
<div class="m-demo-stage"><iframe src="../../../frameworks-mobile/List.html?demo=custom" title="列表 List · 自定义后缀" loading="lazy"></iframe></div>
<details class="m-details"><summary>查看代码(演示页原文 · 16 行)</summary>
<div class="m-code"><div class="m-code-head"><span>frameworks-mobile/List.html · custom</span><button class="m-copy" type="button" data-copy="code-demo-3">复制</button></div>
<pre id="code-demo-3"><code>&lt;section class=&quot;demo-block&quot; data-demo=&quot;custom&quot;&gt;
&lt;p class=&quot;demo-label&quot;&gt;自定义后缀(后缀位放标签等非文字内容,与值文字共用一行)&lt;/p&gt;
&lt;ul class=&quot;kole-m-list kole-m-list--border&quot; data-assert=&quot;list-custom&quot;&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;
&lt;span class=&quot;kole-m-list__title&quot;&gt;订单 20260920-001&lt;/span&gt;
&lt;span class=&quot;kole-m-list__desc&quot;&gt;顺丰标快 · 预计 09-22 送达&lt;/span&gt;
&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;demo-tag&quot;&gt;已发货&lt;/span&gt;&lt;span class=&quot;kole-m-list__arrow&quot; aria-hidden=&quot;true&quot;&gt;›&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;&lt;span class=&quot;kole-m-list__title&quot;&gt;订单 20260919-114&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;demo-tag&quot;&gt;待付款&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;</code></pre></div>
</details>
</div>
<div class="m-demo" id="demo-divider">
<div class="m-demo-head"><span class="m-demo-title">分隔线两态</span><span class="m-chip">divider=inset|full</span></div>
<p class="m-demo-desc">divider=inset 时线从行内容起点开始;divider=full 时通栏不缩进。</p>
<div class="m-demo-stage"><iframe src="../../../frameworks-mobile/List.html?demo=divider" title="列表 List · 分隔线两态" loading="lazy"></iframe></div>
<details class="m-details"><summary>查看代码(演示页原文 · 21 行)</summary>
<div class="m-code"><div class="m-code-head"><span>frameworks-mobile/List.html · divider</span><button class="m-copy" type="button" data-copy="code-demo-4">复制</button></div>
<pre id="code-demo-4"><code>&lt;section class=&quot;demo-block&quot; data-demo=&quot;divider&quot;&gt;
&lt;p class=&quot;demo-label&quot;&gt;分隔线两态(divider=inset 缩进到内容起点 / full 通栏)&lt;/p&gt;
&lt;ul class=&quot;kole-m-list kole-m-list--border kole-m-list--inset&quot; data-assert=&quot;list-divider-inset&quot;&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__prefix&quot;&gt;&lt;span class=&quot;demo-dot&quot;&gt;A&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;&lt;span class=&quot;kole-m-list__title&quot;&gt;inset:线从内容起点开始&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__prefix&quot;&gt;&lt;span class=&quot;demo-dot&quot;&gt;B&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;&lt;span class=&quot;kole-m-list__title&quot;&gt;缩进量 = 页面留白&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;kole-m-list kole-m-list--border kole-m-list--full&quot; data-assert=&quot;list-divider-full&quot; style=&quot;margin-top: 12px;&quot;&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;&lt;span class=&quot;kole-m-list__title&quot;&gt;full:线通栏,不缩进&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;&lt;span class=&quot;kole-m-list__title&quot;&gt;用于无明显前缀位的列表&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;</code></pre></div>
</details>
</div>
<h3 class="m-demo-group">02 组件状态</h3>
<div class="m-demo" id="demo-compact">
<div class="m-demo-head"><span class="m-demo-title">紧凑尺寸</span><span class="m-chip">size=compact</span></div>
<p class="m-demo-desc">size=compact 行高 44px,仍是触控最小边长,用于高密度筛选类列表。</p>
<div class="m-demo-stage"><iframe src="../../../frameworks-mobile/List.html?demo=compact" title="列表 List · 紧凑尺寸" loading="lazy"></iframe></div>
<details class="m-details"><summary>查看代码(演示页原文 · 17 行)</summary>
<div class="m-code"><div class="m-code-head"><span>frameworks-mobile/List.html · compact</span><button class="m-copy" type="button" data-copy="code-demo-5">复制</button></div>
<pre id="code-demo-5"><code>&lt;section class=&quot;demo-block&quot; data-demo=&quot;compact&quot;&gt;
&lt;p class=&quot;demo-label&quot;&gt;紧凑尺寸(size=compact:行高 44px,仍是触控最小边长)&lt;/p&gt;
&lt;ul class=&quot;kole-m-list kole-m-list--border kole-m-list--compact&quot; data-assert=&quot;list-compact&quot;&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;&lt;span class=&quot;kole-m-list__title&quot;&gt;全部订单&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;kole-m-list__value&quot;&gt;128&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;&lt;span class=&quot;kole-m-list__title&quot;&gt;待评价&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;kole-m-list__value&quot;&gt;6&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;&lt;span class=&quot;kole-m-list__title&quot;&gt;已取消&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;kole-m-list__value&quot;&gt;2&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;</code></pre></div>
</details>
</div>
<div class="m-demo" id="demo-clickable">
<div class="m-demo-head"><span class="m-demo-title">可点行</span><span class="m-chip">events.select</span></div>
<p class="m-demo-desc">可点行是原生 button:键盘可达、按下整行背景变化。</p>
<div class="m-demo-stage"><iframe src="../../../frameworks-mobile/List.html?demo=clickable" title="列表 List · 可点行" loading="lazy"></iframe></div>
<details class="m-details"><summary>查看代码(演示页原文 · 21 行)</summary>
<div class="m-code"><div class="m-code-head"><span>frameworks-mobile/List.html · clickable</span><button class="m-copy" type="button" data-copy="code-demo-6">复制</button></div>
<pre id="code-demo-6"><code>&lt;section class=&quot;demo-block&quot; data-demo=&quot;clickable&quot;&gt;
&lt;p class=&quot;demo-label&quot;&gt;可点行(整行是原生 button:键盘可达、按下整行背景变化)&lt;/p&gt;
&lt;ul class=&quot;kole-m-list kole-m-list--border&quot; data-assert=&quot;list-clickable&quot;&gt;
&lt;li&gt;
&lt;button class=&quot;kole-m-list__item&quot; type=&quot;button&quot; id=&quot;list-row-link&quot;
data-behavior=&quot;click-sets-attr:#list-row-link|data-tapped|true&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;
&lt;span class=&quot;kole-m-list__title&quot;&gt;收货地址&lt;/span&gt;
&lt;span class=&quot;kole-m-list__desc&quot;&gt;杭州市余杭区 · 王小明&lt;/span&gt;
&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;kole-m-list__value&quot;&gt;修改&lt;/span&gt;&lt;span class=&quot;kole-m-list__arrow&quot; aria-hidden=&quot;true&quot;&gt;›&lt;/span&gt;&lt;/span&gt;
&lt;/button&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;button class=&quot;kole-m-list__item&quot; type=&quot;button&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;&lt;span class=&quot;kole-m-list__title&quot;&gt;发票信息&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;kole-m-list__arrow&quot; aria-hidden=&quot;true&quot;&gt;›&lt;/span&gt;&lt;/span&gt;
&lt;/button&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;</code></pre></div>
</details>
</div>
<div class="m-demo" id="demo-disabled">
<div class="m-demo-head"><span class="m-demo-title">禁用行</span><span class="m-chip">状态 disabled</span></div>
<p class="m-demo-desc">状态 disabled:置灰且不响应点击,用于无权限项。</p>
<div class="m-demo-stage"><iframe src="../../../frameworks-mobile/List.html?demo=disabled" title="列表 List · 禁用行" loading="lazy"></iframe></div>
<details class="m-details"><summary>查看代码(演示页原文 · 20 行)</summary>
<div class="m-code"><div class="m-code-head"><span>frameworks-mobile/List.html · disabled</span><button class="m-copy" type="button" data-copy="code-demo-7">复制</button></div>
<pre id="code-demo-7"><code>&lt;section class=&quot;demo-block&quot; data-demo=&quot;disabled&quot;&gt;
&lt;p class=&quot;demo-label&quot;&gt;禁用行(置灰且不响应点击,用于无权限项)&lt;/p&gt;
&lt;ul class=&quot;kole-m-list kole-m-list--border&quot; data-assert=&quot;list-disabled&quot;&gt;
&lt;li&gt;
&lt;button class=&quot;kole-m-list__item is-disabled&quot; type=&quot;button&quot; disabled aria-disabled=&quot;true&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;
&lt;span class=&quot;kole-m-list__title&quot;&gt;企业认证&lt;/span&gt;
&lt;span class=&quot;kole-m-list__desc&quot;&gt;需要管理员权限&lt;/span&gt;
&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;kole-m-list__value&quot;&gt;暂无权限&lt;/span&gt;&lt;/span&gt;
&lt;/button&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;button class=&quot;kole-m-list__item&quot; type=&quot;button&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;&lt;span class=&quot;kole-m-list__title&quot;&gt;实名认证&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;kole-m-list__value&quot;&gt;已完成&lt;/span&gt;&lt;/span&gt;
&lt;/button&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;</code></pre></div>
</details>
</div>
<div class="m-demo" id="demo-empty">
<div class="m-demo-head"><span class="m-demo-title">空列表</span><span class="m-chip">状态 empty</span></div>
<p class="m-demo-desc">状态 empty:占位文案用 aria-live 播报,读屏能听到「暂无订单」。</p>
<div class="m-demo-stage"><iframe src="../../../frameworks-mobile/List.html?demo=empty" title="列表 List · 空列表" loading="lazy"></iframe></div>
<details class="m-details"><summary>查看代码(演示页原文 · 6 行)</summary>
<div class="m-code"><div class="m-code-head"><span>frameworks-mobile/List.html · empty</span><button class="m-copy" type="button" data-copy="code-demo-8">复制</button></div>
<pre id="code-demo-8"><code>&lt;section class=&quot;demo-block&quot; data-demo=&quot;empty&quot;&gt;
&lt;p class=&quot;demo-label&quot;&gt;空列表(状态 empty:占位文案用 aria-live 播报)&lt;/p&gt;
&lt;ul class=&quot;kole-m-list kole-m-list--border&quot; data-assert=&quot;list-empty&quot;&gt;
&lt;li&gt;&lt;p class=&quot;kole-m-list__empty&quot; aria-live=&quot;polite&quot;&gt;暂无订单,去逛逛吧&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;</code></pre></div>
</details>
</div>
</section>
<section class="m-block">
<h2 id="api">API</h2>
<p class="m-sub">props / events / slots 为 6 端实现的公共接口(说明文字取自规格对应小节)。字段名与各端源码逐名核对:node tools/verify-mobile-docs.mjs</p>
<h3 class="m-h3">Props</h3>
<table class="m-table">
<thead><tr><th>名称</th><th>类型</th><th>默认值</th><th>说明</th><th>必传</th></tr></thead>
<tbody>
<tr><td><code>items</code></td><td><code>Array</code></td><td><code>[]</code></td><td>数据驱动的行数组,每项含 title / desc / value / prefix / arrow / static / disabled(规格 §24.2)</td><td>N</td></tr>
<tr><td><code>size</code></td><td><code>'default' | 'compact'</code></td><td><code>'default'</code></td><td>变体 size:default 行高 56px / compact 44px(规格 §24.3)</td><td>N</td></tr>
<tr><td><code>border</code></td><td><code>boolean</code></td><td><code>true</code></td><td>变体 border:是否画行间 1px 分隔线(规格 §24.3)</td><td>N</td></tr>
<tr><td><code>divider</code></td><td><code>'inset' | 'full'</code></td><td><code>'inset'</code></td><td>变体 divider:分隔线缩进到内容起点 / 通栏(规格 §24.3)</td><td>N</td></tr>
<tr><td><code>header</code></td><td><code>string</code></td><td><code>''</code></td><td>分组标题,位于列表之上(规格 §24.2 header)</td><td>N</td></tr>
<tr><td><code>footer</code></td><td><code>string</code></td><td><code>''</code></td><td>分组脚注,用于补充说明(规格 §24.2 footer)</td><td>N</td></tr>
<tr><td><code>emptyText</code></td><td><code>string</code></td><td><code>''</code></td><td>状态 empty:列表为空时的占位文案(规格 §24.4)</td><td>N</td></tr>
</tbody>
</table>
<p class="m-note">「必传」按严格定义:实现里**没有默认值**时才为 Y(本门禁逐条核对 props 与各端源码的默认值,防止契约与实现脱节)。</p>
<h3 class="m-h3">事件</h3>
<table class="m-table">
<thead><tr><th>名称</th><th>参数</th><th>说明</th></tr></thead>
<tbody>
<tr><td><code>select</code></td><td><code>(index)</code></td><td>可点行被点击时触发,回传该行在 items 里的下标</td></tr>
</tbody>
</table>
<h3 class="m-h3">插槽</h3>
<table class="m-table">
<thead><tr><th>名称</th><th>说明</th></tr></thead>
<tbody>
<tr><td><code>default</code></td><td>追加在数据驱动行之后的自定义行(规格 §24.2 item)</td></tr>
<tr><td><code>empty</code></td><td>状态 empty 的自定义占位内容,替代 emptyText(规格 §24.4)</td></tr>
</tbody>
</table>
<h3 class="m-h3">CSS 变量</h3>
<p class="m-sub">组件级变量(在组件样式表里定义)。业务侧可在自己的作用域内覆盖,不必改组件源码。</p>
<table class="m-table">
<thead><tr><th>名称</th><th>默认值</th><th>说明</th></tr></thead>
<tbody>
<tr><td><code>--kole-m-list-row-height</code></td><td><code>56px</code></td><td>default 行高(compact 44px)</td></tr>
<tr><td><code>--kole-m-list-divider-inset</code></td><td><code>var(--kole-m-gutter)</code></td><td>分隔线左端缩进(= 页面留白)</td></tr>
<tr><td><code>--kole-m-list-row-height</code></td><td><code>44px</code></td><td>组件内部默认值,可在业务侧覆盖</td></tr>
</tbody>
</table>
</section>
<section class="m-block">
<h2 id="usage">何时使用</h2>
<ul>
<li>把一组同类信息按行排列,用于「设置项 / 订单 / 成员」这类需要扫读的场合</li>
<li>移动端一屏只有 6~8 行,每行信息层级必须收敛到「标题 + 可选的说明或值」</li>
<li>分组之间用标题与留白分隔,而不是靠边框</li>
<li>可点行整行都是热区,default 行高不小于 56px、compact 不小于 44px</li>
<li>列表滚动由宿主容器负责;本组件不接管滚动、不做虚拟列表</li>
</ul>
</section>
<section class="m-block">
<h2 id="interaction">交互与触控</h2>
<ul>
<li>可点行整行都是热区,default 行高不小于 56px、compact 不小于 44px</li>
<li>按下反馈是整行背景变化,不是只有文字变色</li>
<li>前缀位不参与点击判定(点图标等于点整行),后缀位里的独立控件(开关、按钮)要阻止事件冒泡,避免一次点击触发两个动作</li>
<li>列表滚动由宿主容器负责;本组件不接管滚动、不做虚拟列表</li>
</ul>
</section>
<section class="m-block">
<h2 id="a11y">无障碍</h2>
<ul>
<li>容器 role=&quot;list&quot;,纯展示行 role=&quot;listitem&quot;;可点行用原生 button(原生语义优先于 listitem)</li>
<li>分组标题用 aria-label 或可见文本,读屏在进入分组时能读到</li>
<li>空列表用 aria-live=&quot;polite&quot; 播报占位文案</li>
</ul>
</section>
<section class="m-block">
<h2 id="related">相似组件</h2>
<p class="m-sub">从「该用哪一个」的角度区分;PC 端的对应实现见 <a href="../../index.html">PC 文档站</a>。</p>
<table class="m-table">
<thead><tr><th>组件</th><th>何时用它而不是本组件</th></tr></thead>
<tbody>
<tr><td><a href="cell.html">单元格</a><em style="font-family: var(--kole-font-family-num); font-style: normal; font-size: 11px; color: var(--kole-color-text-placeholder); margin-left: 6px;">Cell</em></td><td>单行信息用单元格(自带 arrow / value 语义);成组出现且需要分组标题与脚注时用列表</td></tr>
<tr><td><a href="swipecell.html">滑动单元格</a><em style="font-family: var(--kole-font-family-num); font-style: normal; font-size: 11px; color: var(--kole-color-text-placeholder); margin-left: 6px;">SwipeCell</em></td><td>行内还需要左滑操作时用滑动单元格;只做扫读与点击用列表</td></tr>
<tr><td><a href="mobile-avatar.html">头像</a><em style="font-family: var(--kole-font-family-num); font-style: normal; font-size: 11px; color: var(--kole-color-text-placeholder); margin-left: 6px;">Avatar</em></td><td>行的前缀位放头像时用头像组件;列表只负责行的骨架</td></tr>
<tr><td><a href="mobile-collapse.html">折叠面板</a><em style="font-family: var(--kole-font-family-num); font-style: normal; font-size: 11px; color: var(--kole-color-text-placeholder); margin-left: 6px;">Collapse</em></td><td>行点击后要就地展开内容用折叠面板;跳转到新页面用列表的可点行</td></tr>
</tbody>
</table>
</section>
<section class="m-block">
<h2 id="gaps">规格未定 / 禁止发明</h2>
<table class="m-table">
<thead><tr><th>类别</th><th>条目</th></tr></thead>
<tbody>
<tr><td><span class="m-chip">禁止发明</span></td><td>虚拟滚动与无限加载的触发规则</td></tr>
<tr><td><span class="m-chip">禁止发明</span></td><td>行的拖拽排序与左滑操作(那是 SwipeCell 的职责)</td></tr>
<tr><td><span class="m-chip">规格未定</span></td><td>单行最多几列(前缀 + 主区 + 后缀之外的排布)</td></tr>
<tr><td><span class="m-chip">规格未定</span></td><td>分组标题是否吸顶</td></tr>
</tbody>
</table>
</section>
<section class="m-block">
<h2 id="anatomy">结构(anatomy)</h2>
<table class="m-table">
<thead><tr><th>字段</th><th>说明</th></tr></thead>
<tbody>
<tr><td><code>list</code></td><td>根元素,一个列表区块</td></tr>
<tr><td><code>header</code></td><td>可选分组标题,位于列表之上</td></tr>
<tr><td><code>item</code></td><td>列表项,一行承载「前缀 + 主区 + 后缀」</td></tr>
<tr><td><code>prefix</code></td><td>可选前缀位(头像、图标、序号)</td></tr>
<tr><td><code>body</code></td><td>主区,标题 + 可选副标题,两行都单行省略</td></tr>
<tr><td><code>suffix</code></td><td>可选后缀位(值文字、标签、箭头、开关)</td></tr>
<tr><td><code>footer</code></td><td>可选分组脚注,用于补充说明</td></tr>
</tbody>
</table>
</section>
<section class="m-block">
<h2 id="variants">变体维度与类名映射</h2>
<p class="m-sub">类名映射由构建脚本从契约 <code>variantClasses</code> 生成,并被 <code>verify:mobile-docs</code> 逐条对照组件 CSS 校验(类/变量必须真实存在)。</p>
<table class="m-table">
<thead><tr><th>维度</th><th>取值</th><th>对应类名 / 变量</th></tr></thead>
<tbody>
<tr><td><code>border</code></td><td>true / false</td><td><div><b>true</b> <span class="m-cls">.kole-m-list--border</span></div><div><b>false</b> <span class="m-none">(由数据驱动,无专属类)</span></div></td></tr>
<tr><td><code>size</code></td><td>default / compact</td><td><div><b>default</b> <span class="m-none">(由数据驱动,无专属类)</span></div><div><b>compact</b> <span class="m-cls">.kole-m-list--compact</span></div></td></tr>
<tr><td><code>divider</code></td><td>inset / full</td><td><div><b>inset</b> <span class="m-cls">.kole-m-list--inset</span></div><div><b>full</b> <span class="m-cls">.kole-m-list--full</span></div></td></tr>
</tbody>
</table>
</section>
<section class="m-block">
<h2 id="rep-variants">代表变体</h2>
<table class="m-table">
<thead><tr><th>变体</th><th>标签</th></tr></thead>
<tbody>
<tr><td><code>border=true · size=default · divider=inset</code></td><td>标准分组列表(默认:行高 56px、分隔线缩进)</td></tr>
<tr><td><code>border=true · size=compact · divider=full</code></td><td>紧凑高密度列表(行高 44px、通栏分隔线)</td></tr>
<tr><td><code>border=false · size=default · divider=inset</code></td><td>无分隔线列表(靠留白分组)</td></tr>
</tbody>
</table>
</section>
<section class="m-block">
<h2 id="tokens">用到的令牌</h2>
<p class="m-sub">构建时从本组件样式表扫描得出。蓝色为移动端自有令牌,绿色为继承的 PC 令牌(改一处两端生效)。</p>
<div class="m-chips">
<span class="m-chip m" title="正文 / 列表项">--kole-m-font-size-body</span>
<span class="m-chip m" title="次级说明">--kole-m-font-size-label</span>
<span class="m-chip m" title="页面左右留白">--kole-m-gutter</span>
<span class="m-chip inherit" title="分割线/边框">--kole-color-border</span>
<span class="m-chip inherit" title="卡片背景">--kole-color-card-bg</span>
<span class="m-chip inherit" title="输入框聚焦外发光">--kole-color-focus-ring</span>
<span class="m-chip inherit" title="页面背景">--kole-color-page-bg</span>
<span class="m-chip inherit" title="表头背景">--kole-color-table-header-bg</span>
<span class="m-chip inherit" title="正文文字 · 14.0:1">--kole-color-text-body</span>
<span class="m-chip inherit" title="禁用态文字 · WCAG 1.4.3 对禁用控件豁免(规范定义于组件1/2.txt)">--kole-color-text-disabled</span>
<span class="m-chip inherit" title="占位文字 · 4.54:1(原 #BFBFBF 仅 1.84:1)">--kole-color-text-placeholder</span>
<span class="m-chip inherit" title="次要文字 · 5.10:1(原 #8C8C8C 仅 3.36:1)">--kole-color-text-secondary</span>
<span class="m-chip inherit" title="标题文字 · 15.4:1">--kole-color-text-title</span>
<span class="m-chip inherit" title="">--kole-font-family</span>
<span class="m-chip inherit" title="">--kole-space-12</span>
<span class="m-chip inherit" title="">--kole-space-40</span>
<span class="m-chip inherit" title="">--kole-space-8</span>
<span class="m-chip" title="组件级变量(可在业务侧覆盖)">--kole-m-list-divider-inset</span>
<span class="m-chip" title="组件级变量(可在业务侧覆盖)">--kole-m-list-row-height</span>
</div>
</section>
<section class="m-block">
<h2 id="sources">6 端源码</h2>
<p class="m-sub">同一组件的六份实现(生产环境的类名与结构一致,差异只在技术栈写法与单位)。点开查看,右侧可复制。</p>
<details class="m-details">
<summary>frameworks-mobile/List.css · 纯样式(CSS) · 167 行</summary>
<div class="m-code">
<div class="m-code-head"><span>frameworks-mobile/List.css</span><button class="m-copy" type="button" data-copy="code-139">复制</button></div>
<pre id="code-139"><code>/* Kole UI Mobile · List 样式 — 对齐移动端规格 §24
列表:一组同类信息按行排列。default 行高 56px、compact 44px;
行间 1px 分隔线用 ::after 画(inset 缩进到行内容起点,full 通栏),可点行整行热区。 */
.kole-m-list {
--kole-m-list-row-height: 56px; /* default 行高(compact 44px) */
--kole-m-list-divider-inset: var(--kole-m-gutter); /* 分隔线左端缩进(= 页面留白) */
box-sizing: border-box;
width: 100%;
margin: 0;
padding: 0;
list-style: none;
background: var(--kole-color-card-bg);
font-family: var(--kole-font-family);
color: var(--kole-color-text-body);
font-size: var(--kole-m-font-size-body);
line-height: 1.4;
}
/* 变体 size=compact:行高 44px(仍不小于触控最小边长),用于高密度列表 */
.kole-m-list--compact {
--kole-m-list-row-height: 44px;
font-size: var(--kole-m-font-size-label);
}
/* 变体 divider:inset 缩进到行内容起点 / full 通栏 —— 只在 border=true 时可见 */
.kole-m-list--inset { --kole-m-list-divider-inset: var(--kole-m-gutter); }
.kole-m-list--full { --kole-m-list-divider-inset: 0px; }
/* 分组标题与脚注:在卡片之外,靠留白区分分组 */
.kole-m-list__header,
.kole-m-list__footer {
margin: 0;
padding: var(--kole-space-12) var(--kole-m-gutter) var(--kole-space-8);
background: var(--kole-color-page-bg);
color: var(--kole-color-text-secondary);
font-size: var(--kole-m-font-size-label);
}
.kole-m-list__footer {
padding-top: var(--kole-space-8);
padding-bottom: var(--kole-space-12);
}
/* 行:前缀位 + 主区 + 后缀位 */
.kole-m-list__item {
box-sizing: border-box;
display: flex;
align-items: center;
gap: var(--kole-space-12);
width: 100%;
min-height: var(--kole-m-list-row-height);
padding: var(--kole-space-12) var(--kole-m-gutter);
margin: 0;
border: 0;
background: var(--kole-color-card-bg);
color: var(--kole-color-text-body);
font-family: inherit;
font-size: inherit;
line-height: 1.4;
text-align: start;
}
/* 变体 border=true:行间 1px 分隔线。
线画在**列表子项**(li)的上沿而不是行的下沿 —— 行既可能是 li 本身,
也可能是 li 里的原生 button(可点行),挂在下沿会让两层 :last-child 都对不上。
绝对定位保证线画在行背景之上。 */
.kole-m-list--border &gt; * { position: relative; }
.kole-m-list--border &gt; * + *::after {
content: '';
position: absolute;
top: 0;
left: var(--kole-m-list-divider-inset);
right: 0;
height: 1px;
background: var(--kole-color-border);
}
/* 可点行:整行热区,按下反馈是整行背景变化(不是只有文字变色) */
button.kole-m-list__item {
cursor: pointer;
touch-action: manipulation;
}
button.kole-m-list__item:active { background: var(--kole-color-table-header-bg); }
/* 状态 disabled:置灰且不响应点击 */
.kole-m-list__item.is-disabled,
.kole-m-list__item:disabled {
color: var(--kole-color-text-disabled);
cursor: not-allowed;
}
.kole-m-list__item.is-disabled:active,
.kole-m-list__item:disabled:active { background: var(--kole-color-card-bg); }
/* 前缀位(头像 / 图标 / 序号):装饰性,点击等于点整行 */
.kole-m-list__prefix {
flex: 0 0 auto;
display: inline-flex;
align-items: center;
color: var(--kole-color-text-secondary);
}
/* 主区:标题 + 可选副标题,两行都单行省略 */
.kole-m-list__body {
flex: 1 1 auto;
min-width: 0;
display: flex;
flex-direction: column;
gap: 2px;
}
.kole-m-list__title {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
color: var(--kole-color-text-title);
}
.kole-m-list__desc {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-size: var(--kole-m-font-size-label);
color: var(--kole-color-text-secondary);
}
/* 后缀位:值文字 / 标签 / 箭头 */
.kole-m-list__suffix {
flex: 0 0 auto;
display: inline-flex;
align-items: center;
gap: var(--kole-space-8);
max-width: 45%;
font-size: var(--kole-m-font-size-label);
color: var(--kole-color-text-secondary);
}
.kole-m-list__value {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.kole-m-list__arrow {
flex: 0 0 auto;
display: inline-flex;
color: var(--kole-color-text-placeholder);
}
/* 状态 empty:空列表占位(宿主用 aria-live 播报) */
.kole-m-list__empty {
margin: 0;
padding: var(--kole-space-40) var(--kole-m-gutter);
background: var(--kole-color-card-bg);
color: var(--kole-color-text-secondary);
font-size: var(--kole-m-font-size-label);
text-align: center;
}
button.kole-m-list__item:focus-visible {
outline: 2px solid var(--kole-color-focus-ring);
outline-offset: -2px;
}
</code></pre>
</div>
</details>
<details class="m-details">
<summary>frameworks-mobile/List.html · H5 原生(无框架) · 208 行</summary>
<div class="m-code">
<div class="m-code-head"><span>frameworks-mobile/List.html</span><button class="m-copy" type="button" data-copy="code-140">复制</button></div>
<pre id="code-140"><code>&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;zh-CN&quot;&gt;
&lt;head&gt;
&lt;meta charset=&quot;UTF-8&quot;&gt;
&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0, viewport-fit=cover&quot;&gt;
&lt;title&gt;Kole UI Mobile · List(H5)&lt;/title&gt;
&lt;link rel=&quot;stylesheet&quot; href=&quot;../.design_library/kole-ui-mobile/colors_and_type.css&quot;&gt;
&lt;link rel=&quot;stylesheet&quot; href=&quot;List.css&quot;&gt;
&lt;style&gt;
body { margin: 0; background: var(--kole-color-page-bg); font-family: var(--kole-font-family); color: var(--kole-color-text-body); }
.demo { max-width: 375px; margin: 0 auto; padding: var(--kole-m-gutter) 0; }
.demo-label { margin: 0; padding: var(--kole-space-12) var(--kole-m-gutter) var(--kole-space-8);
font-size: var(--kole-m-font-size-label); color: var(--kole-color-text-secondary); }
.demo-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px;
background: var(--kole-color-brand-bg); color: var(--kole-color-brand); font-size: var(--kole-m-font-size-caption); }
/* 前缀位占位块:代表宿主放进来的头像 / 图标(纯展示,不承载交互) */
.demo-dot { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
border-radius: 50%; background: var(--kole-color-brand-bg); color: var(--kole-color-brand);
font-size: var(--kole-m-font-size-label); }
.demo-block[hidden] { display: none; }
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div class=&quot;demo&quot;&gt;
&lt;section class=&quot;demo-block&quot; data-demo=&quot;basic&quot;&gt;
&lt;p class=&quot;demo-label&quot;&gt;基础列表(可点行整行热区 ≥56px,后缀位放值与箭头)&lt;/p&gt;
&lt;ul class=&quot;kole-m-list kole-m-list--border&quot; data-assert=&quot;list-basic&quot;&gt;
&lt;li class=&quot;kole-m-list__item&quot; data-assert=&quot;list-basic-row-1&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;
&lt;span class=&quot;kole-m-list__title&quot;&gt;待付款&lt;/span&gt;
&lt;span class=&quot;kole-m-list__desc&quot;&gt;共 2 笔,合计 ¥ 328.00&lt;/span&gt;
&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;kole-m-list__value&quot;&gt;去支付&lt;/span&gt;&lt;span class=&quot;kole-m-list__arrow&quot; aria-hidden=&quot;true&quot;&gt;›&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;&lt;span class=&quot;kole-m-list__title&quot;&gt;待收货&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;kole-m-list__value&quot;&gt;1 件&lt;/span&gt;&lt;span class=&quot;kole-m-list__arrow&quot; aria-hidden=&quot;true&quot;&gt;›&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;&lt;span class=&quot;kole-m-list__title&quot;&gt;退款/售后&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;kole-m-list__value&quot;&gt;无&lt;/span&gt;&lt;span class=&quot;kole-m-list__arrow&quot; aria-hidden=&quot;true&quot;&gt;›&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;
&lt;section class=&quot;demo-block&quot; data-demo=&quot;prefix&quot;&gt;
&lt;p class=&quot;demo-label&quot;&gt;带前缀位(前缀是装饰,点击等于点整行)&lt;/p&gt;
&lt;ul class=&quot;kole-m-list kole-m-list--border&quot; data-assert=&quot;list-prefix&quot;&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__prefix&quot;&gt;&lt;span class=&quot;demo-dot&quot;&gt;王&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;
&lt;span class=&quot;kole-m-list__title&quot;&gt;王小明&lt;/span&gt;
&lt;span class=&quot;kole-m-list__desc&quot;&gt;产品设计部 · 交互设计师&lt;/span&gt;
&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;kole-m-list__value&quot;&gt;在职&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__prefix&quot;&gt;&lt;span class=&quot;demo-dot&quot;&gt;李&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;
&lt;span class=&quot;kole-m-list__title&quot;&gt;李小红&lt;/span&gt;
&lt;span class=&quot;kole-m-list__desc&quot;&gt;前端研发部 · 工程师&lt;/span&gt;
&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;kole-m-list__value&quot;&gt;休假&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;
&lt;section class=&quot;demo-block&quot; data-demo=&quot;custom&quot;&gt;
&lt;p class=&quot;demo-label&quot;&gt;自定义后缀(后缀位放标签等非文字内容,与值文字共用一行)&lt;/p&gt;
&lt;ul class=&quot;kole-m-list kole-m-list--border&quot; data-assert=&quot;list-custom&quot;&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;
&lt;span class=&quot;kole-m-list__title&quot;&gt;订单 20260920-001&lt;/span&gt;
&lt;span class=&quot;kole-m-list__desc&quot;&gt;顺丰标快 · 预计 09-22 送达&lt;/span&gt;
&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;demo-tag&quot;&gt;已发货&lt;/span&gt;&lt;span class=&quot;kole-m-list__arrow&quot; aria-hidden=&quot;true&quot;&gt;›&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;&lt;span class=&quot;kole-m-list__title&quot;&gt;订单 20260919-114&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;demo-tag&quot;&gt;待付款&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;
&lt;section class=&quot;demo-block&quot; data-demo=&quot;divider&quot;&gt;
&lt;p class=&quot;demo-label&quot;&gt;分隔线两态(divider=inset 缩进到内容起点 / full 通栏)&lt;/p&gt;
&lt;ul class=&quot;kole-m-list kole-m-list--border kole-m-list--inset&quot; data-assert=&quot;list-divider-inset&quot;&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__prefix&quot;&gt;&lt;span class=&quot;demo-dot&quot;&gt;A&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;&lt;span class=&quot;kole-m-list__title&quot;&gt;inset:线从内容起点开始&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__prefix&quot;&gt;&lt;span class=&quot;demo-dot&quot;&gt;B&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;&lt;span class=&quot;kole-m-list__title&quot;&gt;缩进量 = 页面留白&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class=&quot;kole-m-list kole-m-list--border kole-m-list--full&quot; data-assert=&quot;list-divider-full&quot; style=&quot;margin-top: 12px;&quot;&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;&lt;span class=&quot;kole-m-list__title&quot;&gt;full:线通栏,不缩进&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;&lt;span class=&quot;kole-m-list__title&quot;&gt;用于无明显前缀位的列表&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;
&lt;section class=&quot;demo-block&quot; data-demo=&quot;compact&quot;&gt;
&lt;p class=&quot;demo-label&quot;&gt;紧凑尺寸(size=compact:行高 44px,仍是触控最小边长)&lt;/p&gt;
&lt;ul class=&quot;kole-m-list kole-m-list--border kole-m-list--compact&quot; data-assert=&quot;list-compact&quot;&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;&lt;span class=&quot;kole-m-list__title&quot;&gt;全部订单&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;kole-m-list__value&quot;&gt;128&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;&lt;span class=&quot;kole-m-list__title&quot;&gt;待评价&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;kole-m-list__value&quot;&gt;6&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li class=&quot;kole-m-list__item&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;&lt;span class=&quot;kole-m-list__title&quot;&gt;已取消&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;kole-m-list__value&quot;&gt;2&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;
&lt;section class=&quot;demo-block&quot; data-demo=&quot;clickable&quot;&gt;
&lt;p class=&quot;demo-label&quot;&gt;可点行(整行是原生 button:键盘可达、按下整行背景变化)&lt;/p&gt;
&lt;ul class=&quot;kole-m-list kole-m-list--border&quot; data-assert=&quot;list-clickable&quot;&gt;
&lt;li&gt;
&lt;button class=&quot;kole-m-list__item&quot; type=&quot;button&quot; id=&quot;list-row-link&quot;
data-behavior=&quot;click-sets-attr:#list-row-link|data-tapped|true&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;
&lt;span class=&quot;kole-m-list__title&quot;&gt;收货地址&lt;/span&gt;
&lt;span class=&quot;kole-m-list__desc&quot;&gt;杭州市余杭区 · 王小明&lt;/span&gt;
&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;kole-m-list__value&quot;&gt;修改&lt;/span&gt;&lt;span class=&quot;kole-m-list__arrow&quot; aria-hidden=&quot;true&quot;&gt;›&lt;/span&gt;&lt;/span&gt;
&lt;/button&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;button class=&quot;kole-m-list__item&quot; type=&quot;button&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;&lt;span class=&quot;kole-m-list__title&quot;&gt;发票信息&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;kole-m-list__arrow&quot; aria-hidden=&quot;true&quot;&gt;›&lt;/span&gt;&lt;/span&gt;
&lt;/button&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;
&lt;section class=&quot;demo-block&quot; data-demo=&quot;disabled&quot;&gt;
&lt;p class=&quot;demo-label&quot;&gt;禁用行(置灰且不响应点击,用于无权限项)&lt;/p&gt;
&lt;ul class=&quot;kole-m-list kole-m-list--border&quot; data-assert=&quot;list-disabled&quot;&gt;
&lt;li&gt;
&lt;button class=&quot;kole-m-list__item is-disabled&quot; type=&quot;button&quot; disabled aria-disabled=&quot;true&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;
&lt;span class=&quot;kole-m-list__title&quot;&gt;企业认证&lt;/span&gt;
&lt;span class=&quot;kole-m-list__desc&quot;&gt;需要管理员权限&lt;/span&gt;
&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;kole-m-list__value&quot;&gt;暂无权限&lt;/span&gt;&lt;/span&gt;
&lt;/button&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;button class=&quot;kole-m-list__item&quot; type=&quot;button&quot;&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;&lt;span class=&quot;kole-m-list__title&quot;&gt;实名认证&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;&lt;span class=&quot;kole-m-list__value&quot;&gt;已完成&lt;/span&gt;&lt;/span&gt;
&lt;/button&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;
&lt;section class=&quot;demo-block&quot; data-demo=&quot;empty&quot;&gt;
&lt;p class=&quot;demo-label&quot;&gt;空列表(状态 empty:占位文案用 aria-live 播报)&lt;/p&gt;
&lt;ul class=&quot;kole-m-list kole-m-list--border&quot; data-assert=&quot;list-empty&quot;&gt;
&lt;li&gt;&lt;p class=&quot;kole-m-list__empty&quot; aria-live=&quot;polite&quot;&gt;暂无订单,去逛逛吧&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;
&lt;/div&gt;
&lt;script&gt;
/* 演示页脚本:可点行被点击后打个标记(真实业务里是路由跳转或拉取详情)。
事件委托到列表容器,避免给每一行都绑监听。 */
(function () {
var row = document.getElementById('list-row-link');
if (!row) return;
row.addEventListener('click', function () {
row.setAttribute('data-tapped', 'true');
});
})();
&lt;/script&gt;
&lt;script&gt;
/* ?demo=&lt;id&gt; → 只显示该演示块(文档站按块预览用;无参数时全部显示,测试与回归走无参数路径) */
(function () {
var id = new URLSearchParams(location.search).get('demo');
if (!id) return;
var blocks = Array.prototype.slice.call(document.querySelectorAll('.demo-block'));
var hit = false;
blocks.forEach(function (b) {
var on = b.getAttribute('data-demo') === id;
if (on) hit = true;
b.hidden = !on;
});
if (!hit) { blocks.forEach(function (b) { b.hidden = false; }); return; }
document.body.classList.add('demo-single');
blocks.forEach(function (b) {
var label = b.querySelector('.demo-label');
if (label &amp;&amp; !b.hidden) label.hidden = true;
});
})();
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
</div>
</details>
<details class="m-details">
<summary>frameworks-mobile/List.jsx · React · 88 行</summary>
<div class="m-code">
<div class="m-code-head"><span>frameworks-mobile/List.jsx</span><button class="m-copy" type="button" data-copy="code-141">复制</button></div>
<pre id="code-141"><code>import React from 'react';
import './List.css';
/* 列表(移动端)— 规格 §24
一行 = 前缀位 + 主区 + 后缀位;可点行是原生 button(整行热区、键盘可达),
纯展示行用 div + role=&quot;listitem&quot;(原生语义优先于 listitem)。
本端不接管滚动、不做虚拟列表(规格 §24.5);inline 控件要自己阻止冒泡,避免一次点击触发两个动作。 */
export default function List({
items = [],
size = 'default',
border = true,
divider = 'inset',
header = '',
footer = '',
emptyText = '',
onSelect,
children = null,
empty = null,
}) {
const cls =
'kole-m-list' +
(size === 'compact' ? ' kole-m-list--compact' : '') +
(border ? ' kole-m-list--border' : '') +
` kole-m-list--${divider}`;
const suffixOf = (it) =&gt; (
&lt;&gt;
{it.value ? &lt;span className=&quot;kole-m-list__value&quot;&gt;{it.value}&lt;/span&gt; : null}
{it.arrow ? (
&lt;span className=&quot;kole-m-list__arrow&quot; aria-hidden=&quot;true&quot;&gt;
›
&lt;/span&gt;
) : null}
&lt;/&gt;
);
const bodyOf = (it) =&gt; (
&lt;&gt;
{it.prefix ? &lt;span className=&quot;kole-m-list__prefix&quot;&gt;{it.prefix}&lt;/span&gt; : null}
&lt;span className=&quot;kole-m-list__body&quot;&gt;
&lt;span className=&quot;kole-m-list__title&quot;&gt;{it.title}&lt;/span&gt;
{it.desc ? &lt;span className=&quot;kole-m-list__desc&quot;&gt;{it.desc}&lt;/span&gt; : null}
&lt;/span&gt;
&lt;/&gt;
);
if (!items.length) {
return (
&lt;div className={cls} role=&quot;list&quot; aria-live=&quot;polite&quot;&gt;
{header ? &lt;p className=&quot;kole-m-list__header&quot;&gt;{header}&lt;/p&gt; : null}
{empty || &lt;p className=&quot;kole-m-list__empty&quot;&gt;{emptyText || '暂无数据'}&lt;/p&gt;}
{footer ? &lt;p className=&quot;kole-m-list__footer&quot;&gt;{footer}&lt;/p&gt; : null}
&lt;/div&gt;
);
}
return (
&lt;div className={cls} role=&quot;list&quot;&gt;
{header ? &lt;p className=&quot;kole-m-list__header&quot;&gt;{header}&lt;/p&gt; : null}
{items.map((it, i) =&gt;
it &amp;&amp; it.static ? (
/* 纯展示行:div + role=&quot;listitem&quot;,不绑点击(规格 §24.6) */
&lt;div key={it.key || i} className={'kole-m-list__item' + (it.disabled ? ' is-disabled' : '')} role=&quot;listitem&quot; aria-disabled={it.disabled ? 'true' : undefined}&gt;
{bodyOf(it)}
&lt;span className=&quot;kole-m-list__suffix&quot;&gt;{suffixOf(it)}&lt;/span&gt;
&lt;/div&gt;
) : (
&lt;button
key={it.key || i}
className={'kole-m-list__item' + (it.disabled ? ' is-disabled' : '')}
type=&quot;button&quot;
disabled={!!it.disabled}
onClick={(e) =&gt; {
if (it.disabled) return;
if (onSelect) onSelect(i, e);
}}
&gt;
{bodyOf(it)}
&lt;span className=&quot;kole-m-list__suffix&quot;&gt;{suffixOf(it)}&lt;/span&gt;
&lt;/button&gt;
)
)}
{children}
{footer ? &lt;p className=&quot;kole-m-list__footer&quot;&gt;{footer}&lt;/p&gt; : null}
&lt;/div&gt;
);
}
</code></pre>
</div>
</details>
<details class="m-details">
<summary>frameworks-mobile/List.vue2.vue · Vue 2 · 89 行</summary>
<div class="m-code">
<div class="m-code-head"><span>frameworks-mobile/List.vue2.vue</span><button class="m-copy" type="button" data-copy="code-142">复制</button></div>
<pre id="code-142"><code>&lt;template&gt;
&lt;div :class=&quot;listClass&quot; role=&quot;list&quot; :aria-live=&quot;items.length ? null : 'polite'&quot;&gt;
&lt;p v-if=&quot;header&quot; class=&quot;kole-m-list__header&quot;&gt;{{ header }}&lt;/p&gt;
&lt;template v-if=&quot;items.length&quot;&gt;
&lt;template v-for=&quot;(it, i) in items&quot;&gt;
&lt;!-- 纯展示行:div + role=&quot;listitem&quot;,不绑点击(规格 §24.6) --&gt;
&lt;div
v-if=&quot;it &amp;&amp; it.static&quot;
:key=&quot;'static-' + i&quot;
class=&quot;kole-m-list__item&quot;
:class=&quot;{ 'is-disabled': it.disabled }&quot;
role=&quot;listitem&quot;
:aria-disabled=&quot;it.disabled ? 'true' : null&quot;
&gt;
&lt;span v-if=&quot;it.prefix&quot; class=&quot;kole-m-list__prefix&quot;&gt;{{ it.prefix }}&lt;/span&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;
&lt;span class=&quot;kole-m-list__title&quot;&gt;{{ it.title }}&lt;/span&gt;
&lt;span v-if=&quot;it.desc&quot; class=&quot;kole-m-list__desc&quot;&gt;{{ it.desc }}&lt;/span&gt;
&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;
&lt;span v-if=&quot;it.value&quot; class=&quot;kole-m-list__value&quot;&gt;{{ it.value }}&lt;/span&gt;
&lt;span v-if=&quot;it.arrow&quot; class=&quot;kole-m-list__arrow&quot; aria-hidden=&quot;true&quot;&gt;›&lt;/span&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;button
v-else
:key=&quot;'item-' + i&quot;
class=&quot;kole-m-list__item&quot;
:class=&quot;{ 'is-disabled': it &amp;&amp; it.disabled }&quot;
type=&quot;button&quot;
:disabled=&quot;!!(it &amp;&amp; it.disabled)&quot;
@click=&quot;onSelect(i)&quot;
&gt;
&lt;span v-if=&quot;it &amp;&amp; it.prefix&quot; class=&quot;kole-m-list__prefix&quot;&gt;{{ it.prefix }}&lt;/span&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;
&lt;span class=&quot;kole-m-list__title&quot;&gt;{{ it &amp;&amp; it.title }}&lt;/span&gt;
&lt;span v-if=&quot;it &amp;&amp; it.desc&quot; class=&quot;kole-m-list__desc&quot;&gt;{{ it.desc }}&lt;/span&gt;
&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;
&lt;span v-if=&quot;it &amp;&amp; it.value&quot; class=&quot;kole-m-list__value&quot;&gt;{{ it.value }}&lt;/span&gt;
&lt;span v-if=&quot;it &amp;&amp; it.arrow&quot; class=&quot;kole-m-list__arrow&quot; aria-hidden=&quot;true&quot;&gt;›&lt;/span&gt;
&lt;/span&gt;
&lt;/button&gt;
&lt;/template&gt;
&lt;slot&gt;&lt;/slot&gt;
&lt;/template&gt;
&lt;!-- 状态 empty:空列表占位 --&gt;
&lt;slot v-else name=&quot;empty&quot;&gt;
&lt;p class=&quot;kole-m-list__empty&quot;&gt;{{ emptyText || '暂无数据' }}&lt;/p&gt;
&lt;/slot&gt;
&lt;p v-if=&quot;footer&quot; class=&quot;kole-m-list__footer&quot;&gt;{{ footer }}&lt;/p&gt;
&lt;/div&gt;
&lt;/template&gt;
&lt;script&gt;
export default {
name: 'KoleMList',
props: {
items: { type: Array, default: function () { return []; } },
size: { type: String, default: 'default' },
border: { type: Boolean, default: true },
divider: { type: String, default: 'inset' },
header: { type: String, default: '' },
footer: { type: String, default: '' },
emptyText: { type: String, default: '' }
},
computed: {
listClass: function () {
return [
this.size === 'compact' ? 'kole-m-list--compact' : '',
this.border ? 'kole-m-list--border' : '',
'kole-m-list--' + this.divider
].filter(Boolean);
}
},
methods: {
onSelect: function (i) {
this.$emit('select', i);
}
}
};
&lt;/script&gt;
&lt;style src=&quot;./List.css&quot;&gt;&lt;/style&gt;
</code></pre>
</div>
</details>
<details class="m-details">
<summary>frameworks-mobile/List.vue3.vue · Vue 3 · 83 行</summary>
<div class="m-code">
<div class="m-code-head"><span>frameworks-mobile/List.vue3.vue</span><button class="m-copy" type="button" data-copy="code-143">复制</button></div>
<pre id="code-143"><code>&lt;template&gt;
&lt;div :class=&quot;listClass&quot; role=&quot;list&quot; :aria-live=&quot;items.length ? null : 'polite'&quot;&gt;
&lt;p v-if=&quot;header&quot; class=&quot;kole-m-list__header&quot;&gt;{{ header }}&lt;/p&gt;
&lt;template v-if=&quot;items.length&quot;&gt;
&lt;template v-for=&quot;(it, i) in items&quot; :key=&quot;it.key || i&quot;&gt;
&lt;!-- 纯展示行:div + role=&quot;listitem&quot;,不绑点击(规格 §24.6) --&gt;
&lt;div
v-if=&quot;it &amp;&amp; it.static&quot;
class=&quot;kole-m-list__item&quot;
:class=&quot;{ 'is-disabled': it.disabled }&quot;
role=&quot;listitem&quot;
:aria-disabled=&quot;it.disabled ? 'true' : null&quot;
&gt;
&lt;span v-if=&quot;it.prefix&quot; class=&quot;kole-m-list__prefix&quot;&gt;{{ it.prefix }}&lt;/span&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;
&lt;span class=&quot;kole-m-list__title&quot;&gt;{{ it.title }}&lt;/span&gt;
&lt;span v-if=&quot;it.desc&quot; class=&quot;kole-m-list__desc&quot;&gt;{{ it.desc }}&lt;/span&gt;
&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;
&lt;span v-if=&quot;it.value&quot; class=&quot;kole-m-list__value&quot;&gt;{{ it.value }}&lt;/span&gt;
&lt;span v-if=&quot;it.arrow&quot; class=&quot;kole-m-list__arrow&quot; aria-hidden=&quot;true&quot;&gt;›&lt;/span&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;button
v-else
class=&quot;kole-m-list__item&quot;
:class=&quot;{ 'is-disabled': it &amp;&amp; it.disabled }&quot;
type=&quot;button&quot;
:disabled=&quot;!!(it &amp;&amp; it.disabled)&quot;
@click=&quot;onSelect(i)&quot;
&gt;
&lt;span v-if=&quot;it &amp;&amp; it.prefix&quot; class=&quot;kole-m-list__prefix&quot;&gt;{{ it.prefix }}&lt;/span&gt;
&lt;span class=&quot;kole-m-list__body&quot;&gt;
&lt;span class=&quot;kole-m-list__title&quot;&gt;{{ it &amp;&amp; it.title }}&lt;/span&gt;
&lt;span v-if=&quot;it &amp;&amp; it.desc&quot; class=&quot;kole-m-list__desc&quot;&gt;{{ it.desc }}&lt;/span&gt;
&lt;/span&gt;
&lt;span class=&quot;kole-m-list__suffix&quot;&gt;
&lt;span v-if=&quot;it &amp;&amp; it.value&quot; class=&quot;kole-m-list__value&quot;&gt;{{ it.value }}&lt;/span&gt;
&lt;span v-if=&quot;it &amp;&amp; it.arrow&quot; class=&quot;kole-m-list__arrow&quot; aria-hidden=&quot;true&quot;&gt;›&lt;/span&gt;
&lt;/span&gt;
&lt;/button&gt;
&lt;/template&gt;
&lt;slot&gt;&lt;/slot&gt;
&lt;/template&gt;
&lt;!-- 状态 empty:空列表占位 --&gt;
&lt;slot v-else name=&quot;empty&quot;&gt;
&lt;p class=&quot;kole-m-list__empty&quot;&gt;{{ emptyText || '暂无数据' }}&lt;/p&gt;
&lt;/slot&gt;
&lt;p v-if=&quot;footer&quot; class=&quot;kole-m-list__footer&quot;&gt;{{ footer }}&lt;/p&gt;
&lt;/div&gt;
&lt;/template&gt;
&lt;script setup&gt;
import { computed } from 'vue';
const props = defineProps({
items: { type: Array, default: () =&gt; [] },
size: { type: String, default: 'default' },
border: { type: Boolean, default: true },
divider: { type: String, default: 'inset' },
header: { type: String, default: '' },
footer: { type: String, default: '' },
emptyText: { type: String, default: '' }
});
const emit = defineEmits(['select']);
const listClass = computed(() =&gt; [
props.size === 'compact' ? 'kole-m-list--compact' : '',
props.border ? 'kole-m-list--border' : '',
`kole-m-list--${props.divider}`
].filter(Boolean));
function onSelect(i) {
emit('select', i);
}
&lt;/script&gt;
&lt;style src=&quot;./List.css&quot;&gt;&lt;/style&gt;
</code></pre>
</div>
</details>
<details class="m-details">
<summary>frameworks-mobile/List.uniapp.vue · uni-app(跨端:小程序 / App / H5) · 206 行</summary>
<div class="m-code">
<div class="m-code-head"><span>frameworks-mobile/List.uniapp.vue</span><button class="m-copy" type="button" data-copy="code-144">复制</button></div>
<pre id="code-144"><code>&lt;template&gt;
&lt;view class=&quot;kole-m-list&quot; :class=&quot;listClass&quot; role=&quot;list&quot; :aria-live=&quot;items.length ? '' : 'polite'&quot;&gt;
&lt;text v-if=&quot;header&quot; class=&quot;kole-m-list__header&quot;&gt;{{ header }}&lt;/text&gt;
&lt;template v-if=&quot;items.length&quot;&gt;
&lt;view v-for=&quot;row in rows&quot; :key=&quot;row.index&quot; class=&quot;kole-m-list__wrap&quot;&gt;
&lt;view
v-if=&quot;row.item.static&quot;
class=&quot;kole-m-list__item&quot;
:class=&quot;{ 'is-disabled': row.item.disabled }&quot;
role=&quot;listitem&quot;
:aria-disabled=&quot;row.item.disabled ? 'true' : 'false'&quot;
&gt;
&lt;text v-if=&quot;row.item.prefix&quot; class=&quot;kole-m-list__prefix&quot;&gt;{{ row.item.prefix }}&lt;/text&gt;
&lt;view class=&quot;kole-m-list__body&quot;&gt;
&lt;text class=&quot;kole-m-list__title&quot;&gt;{{ row.item.title }}&lt;/text&gt;
&lt;text v-if=&quot;row.item.desc&quot; class=&quot;kole-m-list__desc&quot;&gt;{{ row.item.desc }}&lt;/text&gt;
&lt;/view&gt;
&lt;view class=&quot;kole-m-list__suffix&quot;&gt;
&lt;text v-if=&quot;row.item.value&quot; class=&quot;kole-m-list__value&quot;&gt;{{ row.item.value }}&lt;/text&gt;
&lt;text v-if=&quot;row.item.arrow&quot; class=&quot;kole-m-list__arrow&quot;&gt;›&lt;/text&gt;
&lt;/view&gt;
&lt;/view&gt;
&lt;view
v-else
class=&quot;kole-m-list__item&quot;
:class=&quot;{ 'is-disabled': row.item.disabled }&quot;
:role=&quot;row.item.disabled ? '' : 'button'&quot;
:aria-disabled=&quot;row.item.disabled ? 'true' : 'false'&quot;
@tap=&quot;onSelect(row)&quot;
&gt;
&lt;text v-if=&quot;row.item.prefix&quot; class=&quot;kole-m-list__prefix&quot;&gt;{{ row.item.prefix }}&lt;/text&gt;
&lt;view class=&quot;kole-m-list__body&quot;&gt;
&lt;text class=&quot;kole-m-list__title&quot;&gt;{{ row.item.title }}&lt;/text&gt;
&lt;text v-if=&quot;row.item.desc&quot; class=&quot;kole-m-list__desc&quot;&gt;{{ row.item.desc }}&lt;/text&gt;
&lt;/view&gt;
&lt;view class=&quot;kole-m-list__suffix&quot;&gt;
&lt;text v-if=&quot;row.item.value&quot; class=&quot;kole-m-list__value&quot;&gt;{{ row.item.value }}&lt;/text&gt;
&lt;text v-if=&quot;row.item.arrow&quot; class=&quot;kole-m-list__arrow&quot;&gt;›&lt;/text&gt;
&lt;/view&gt;
&lt;/view&gt;
&lt;/view&gt;
&lt;slot&gt;&lt;/slot&gt;
&lt;/template&gt;
&lt;!-- 状态 empty:空列表占位(宿主可换成自己的插槽内容) --&gt;
&lt;slot v-else name=&quot;empty&quot;&gt;
&lt;text class=&quot;kole-m-list__empty&quot;&gt;{{ emptyText || '暂无数据' }}&lt;/text&gt;
&lt;/slot&gt;
&lt;text v-if=&quot;footer&quot; class=&quot;kole-m-list__footer&quot;&gt;{{ footer }}&lt;/text&gt;
&lt;/view&gt;
&lt;/template&gt;
&lt;script setup&gt;
/* uni-app 端 · 列表(移动端)— 规格 §24
跨端差异:小程序没有 ul/li/button 的列表语义,行一律用 view(标记 role=&quot;listitem&quot; / &quot;button&quot;),
可点行用 @tap;分隔线画在包裹层 .kole-m-list__wrap 的上沿(与 H5 端同一策略 —— 行本身
既可能是纯展示层也可能是可点层,线挂在行下沿会在两种结构里对不上)。
尺寸用 rpx(88rpx = 375pt 下的 44px,故 default 行高 112rpx / compact 88rpx)。 */
import { computed } from 'vue';
const props = defineProps({
items: { type: Array, default: () =&gt; [] },
size: { type: String, default: 'default' },
border: { type: Boolean, default: true },
divider: { type: String, default: 'inset' },
header: { type: String, default: '' },
footer: { type: String, default: '' },
emptyText: { type: String, default: '' }
});
const emit = defineEmits(['select']);
const listClass = computed(() =&gt; [
props.size === 'compact' ? 'kole-m-list--compact' : '',
props.border ? 'kole-m-list--border' : '',
`kole-m-list--${props.divider}`
].filter(Boolean));
/* 行里带上原始下标:select 回传的是被点行在 items 里的下标 */
const rows = computed(() =&gt; (props.items || []).map((item, index) =&gt; ({ item: item || {}, index: index })));
function onSelect(row) {
if (!row || !row.item || row.item.disabled) return;
emit('select', row.index);
}
&lt;/script&gt;
&lt;style&gt;
.kole-m-list {
--kole-m-list-row-height: 112rpx; /* default 行高(compact 88rpx) */
--kole-m-list-divider-inset: 32rpx; /* 分隔线左端缩进(= 页面留白) */
--kole-m-font-size-body: 32rpx;
--kole-m-font-size-label: 28rpx;
--kole-m-gutter: 32rpx;
box-sizing: border-box;
width: 100%;
background-color: var(--kole-color-card-bg);
color: var(--kole-color-text-body);
font-size: var(--kole-m-font-size-body);
}
.kole-m-list--compact {
--kole-m-list-row-height: 88rpx;
font-size: var(--kole-m-font-size-label);
}
.kole-m-list--inset { --kole-m-list-divider-inset: 32rpx; }
.kole-m-list--full { --kole-m-list-divider-inset: 0rpx; }
.kole-m-list__header,
.kole-m-list__footer {
display: block;
padding: 24rpx var(--kole-m-gutter) 16rpx;
background-color: var(--kole-color-page-bg);
color: var(--kole-color-text-secondary);
font-size: var(--kole-m-font-size-label);
}
.kole-m-list__footer { padding-top: 16rpx; padding-bottom: 24rpx; }
.kole-m-list__wrap { position: relative; }
/* 变体 border=true:相邻行之间一条 1rpx 分隔线 */
.kole-m-list--border .kole-m-list__wrap + .kole-m-list__wrap::after {
content: '';
position: absolute;
top: 0;
left: var(--kole-m-list-divider-inset);
right: 0;
height: 1rpx;
background-color: var(--kole-color-border);
}
.kole-m-list__item {
box-sizing: border-box;
display: flex;
align-items: center;
width: 100%;
min-height: var(--kole-m-list-row-height);
padding: 24rpx var(--kole-m-gutter);
background-color: var(--kole-color-card-bg);
color: var(--kole-color-text-body);
font-size: inherit;
}
/* 状态 active:按下反馈是整行背景变化(触屏不用 :hover) */
.kole-m-list__item:active { background-color: var(--kole-color-table-header-bg); }
.kole-m-list__item.is-disabled { color: var(--kole-color-text-disabled); }
.kole-m-list__prefix {
flex-shrink: 0;
margin-right: 24rpx;
color: var(--kole-color-text-secondary);
}
.kole-m-list__body { flex: 1; display: flex; flex-direction: column; }
.kole-m-list__title {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
color: var(--kole-color-text-title);
}
.kole-m-list__desc {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-size: var(--kole-m-font-size-label);
color: var(--kole-color-text-secondary);
}
.kole-m-list__suffix {
flex-shrink: 0;
display: flex;
align-items: center;
max-width: 45%;
font-size: var(--kole-m-font-size-label);
color: var(--kole-color-text-secondary);
}
.kole-m-list__value {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.kole-m-list__arrow {
flex-shrink: 0;
padding-left: 12rpx;
color: var(--kole-color-text-placeholder);
}
.kole-m-list__empty {
display: block;
padding: 80rpx var(--kole-m-gutter);
background-color: var(--kole-color-card-bg);
color: var(--kole-color-text-secondary);
font-size: var(--kole-m-font-size-label);
text-align: center;
}
&lt;/style&gt;
</code></pre>
</div>
</details>
</section>
<section class="m-block">
<h2 id="tests">测试与回归</h2>
<p class="m-sub">断言在真实的 375×640 设备帧里跑(引擎与 PC 侧共用 <code>tests/_runtime.js</code>,触控行为动词来自移动端 <code>tests/mobile/_behaviors.js</code>)。</p>
<p>
<span class="m-status pass">断言 21 条 · 全部通过</span>
<span class="m-status">报告 2026-09-22 03:04:00</span>
</p>
<div class="m-code">
<div class="m-code-head"><span>复现命令</span><button class="m-copy" type="button" data-copy="code-test">复制</button></div>
<pre id="code-test"><code>node site/dev-server.js &amp;
REG_BASE=http://127.0.0.1:3311 node tools/run-mobile-regression.mjs # 全量 5 个组件
npm run verify:mobile-docs # 本页内容完整性 + API 与源码一致性</code></pre>
</div>
</section>
<section class="m-block">
<h2 id="contract">设计契约</h2>
<details class="m-details">
<summary>components/mobile-list.json(点击展开原始 JSON)</summary>
<div class="m-code"><pre><code>{
"schemaVersion": 1,
"sourceKind": "authored-spec",
"provenance": "authored-in-repo",
"specFile": "spec/移动端规格.md",
"specSection": "24 · 列表 List",
"confidence": "high",
"slug": "mobile-list",
"name": "列表 List",
"semanticTypeCandidates": [
"list",
"list-group",
"settings-list"
],
"variantDimensions": [
{
"name": "border",
"values": [
"true",
"false"
]
},
{
"name": "size",
"values": [
"default",
"compact"
]
},
{
"name": "divider",
"values": [
"inset",
"full"
]
}
],
"representativeVariants": [
{
"border": "true",
"size": "default",
"divider": "inset",
"label": "标准分组列表(默认:行高 56px、分隔线缩进)"
},
{
"border": "true",
"size": "compact",
"divider": "full",
"label": "紧凑高密度列表(行高 44px、通栏分隔线)"
},
{
"border": "false",
"size": "default",
"divider": "inset",
"label": "无分隔线列表(靠留白分组)"
}
],
"anatomy": {
"list": "根元素,一个列表区块",
"header": "可选分组标题,位于列表之上",
"item": "列表项,一行承载「前缀 + 主区 + 后缀」",
"prefix": "可选前缀位(头像、图标、序号)",
"body": "主区,标题 + 可选副标题,两行都单行省略",
"suffix": "可选后缀位(值文字、标签、箭头、开关)",
"footer": "可选分组脚注,用于补充说明"
},
"structurePatterns": {
"border": "true(行间 1px 分隔线)/ false(无分隔线,靠间距分组)",
"size": "default(行高 56px)/ compact(行高 44px)",
"divider": "inset(分隔线缩进到行内容起点)/ full(通栏分隔线)"
},
"usageHints": [
"把一组同类信息按行排列,用于「设置项 / 订单 / 成员」这类需要扫读的场合",
"移动端一屏只有 6~8 行,每行信息层级必须收敛到「标题 + 可选的说明或值」",
"分组之间用标题与留白分隔,而不是靠边框",
"可点行整行都是热区,default 行高不小于 56px、compact 不小于 44px",
"列表滚动由宿主容器负责;本组件不接管滚动、不做虚拟列表"
],
"doNotInvent": [
"虚拟滚动与无限加载的触发规则",
"行的拖拽排序与左滑操作(那是 SwipeCell 的职责)"
],
"unknowns": [
"单行最多几列(前缀 + 主区 + 后缀之外的排布)",
"分组标题是否吸顶"
],
"interaction": [
"可点行整行都是热区,default 行高不小于 56px、compact 不小于 44px",
"按下反馈是整行背景变化,不是只有文字变色",
"前缀位不参与点击判定(点图标等于点整行),后缀位里的独立控件(开关、按钮)要阻止事件冒泡,避免一次点击触发两个动作",
"列表滚动由宿主容器负责;本组件不接管滚动、不做虚拟列表"
],
"accessibility": [
"容器 role=\"list\",纯展示行 role=\"listitem\";可点行用原生 button(原生语义优先于 listitem)",
"分组标题用 aria-label 或可见文本,读屏在进入分组时能读到",
"空列表用 aria-live=\"polite\" 播报占位文案"
],
"api": {
"source": "implementation",
"note": "props / events / slots 为 6 端实现的公共接口(说明文字取自规格对应小节)。字段名与各端源码逐名核对:node tools/verify-mobile-docs.mjs",
"requiredNote": "「必传」按严格定义:实现里**没有默认值**时才为 Y(本门禁逐条核对 props 与各端源码的默认值,防止契约与实现脱节)。",
"props": [
{
"name": "items",
"type": "Array",
"default": "[]",
"desc": "数据驱动的行数组,每项含 title / desc / value / prefix / arrow / static / disabled(规格 §24.2)",
"required": false
},
{
"name": "size",
"type": "'default' | 'compact'",
"default": "'default'",
"desc": "变体 size:default 行高 56px / compact 44px(规格 §24.3)",
"required": false
},
{
"name": "border",
"type": "boolean",
"default": "true",
"desc": "变体 border:是否画行间 1px 分隔线(规格 §24.3)",
"required": false
},
{
"name": "divider",
"type": "'inset' | 'full'",
"default": "'inset'",
"desc": "变体 divider:分隔线缩进到内容起点 / 通栏(规格 §24.3)",
"required": false
},
{
"name": "header",
"type": "string",
"default": "''",
"desc": "分组标题,位于列表之上(规格 §24.2 header)",
"required": false
},
{
"name": "footer",
"type": "string",
"default": "''",
"desc": "分组脚注,用于补充说明(规格 §24.2 footer)",
"required": false
},
{
"name": "emptyText",
"type": "string",
"default": "''",
"desc": "状态 empty:列表为空时的占位文案(规格 §24.4)",
"required": false
}
],
"events": [
{
"name": "select",
"params": "(index)",
"desc": "可点行被点击时触发,回传该行在 items 里的下标"
}
],
"slots": [
{
"name": "default",
"desc": "追加在数据驱动行之后的自定义行(规格 §24.2 item)"
},
{
"name": "empty",
"desc": "状态 empty 的自定义占位内容,替代 emptyText(规格 §24.4)"
}
]
},
"variantClasses": {
"border": {
"true": [
".kole-m-list--border"
],
"false": []
},
"size": {
"default": [],
"compact": [
".kole-m-list--compact"
]
},
"divider": {
"inset": [
".kole-m-list--inset"
],
"full": [
".kole-m-list--full"
]
}
},
"demos": [
{
"id": "basic",
"group": "01 组件类型",
"title": "基础列表",
"desc": "标题 + 副标题 + 后缀位(值 + 箭头),行间 1px 分隔线且最后一条不画。",
"variant": "border=true / divider=inset"
},
{
"id": "prefix",
"group": "01 组件类型",
"title": "带前缀位",
"desc": "前缀放头像、图标或序号;它是装饰,点击等于点整行。",
"variant": "anatomy.prefix"
},
{
"id": "custom",
"group": "01 组件类型",
"title": "自定义后缀",
"desc": "后缀位放标签这类非文字内容,与值文字共用一行。",
"variant": "anatomy.suffix"
},
{
"id": "divider",
"group": "01 组件类型",
"title": "分隔线两态",
"desc": "divider=inset 时线从行内容起点开始;divider=full 时通栏不缩进。",
"variant": "divider=inset|full"
},
{
"id": "compact",
"group": "02 组件状态",
"title": "紧凑尺寸",
"desc": "size=compact 行高 44px,仍是触控最小边长,用于高密度筛选类列表。",
"variant": "size=compact"
},
{
"id": "clickable",
"group": "02 组件状态",
"title": "可点行",
"desc": "可点行是原生 button:键盘可达、按下整行背景变化。",
"variant": "events.select"
},
{
"id": "disabled",
"group": "02 组件状态",
"title": "禁用行",
"desc": "状态 disabled:置灰且不响应点击,用于无权限项。",
"variant": "状态 disabled"
},
{
"id": "empty",
"group": "02 组件状态",
"title": "空列表",
"desc": "状态 empty:占位文案用 aria-live 播报,读屏能听到「暂无订单」。",
"variant": "状态 empty"
}
],
"related": [
{
"slug": "cell",
"why": "单行信息用单元格(自带 arrow / value 语义);成组出现且需要分组标题与脚注时用列表"
},
{
"slug": "swipecell",
"why": "行内还需要左滑操作时用滑动单元格;只做扫读与点击用列表"
},
{
"slug": "mobile-avatar",
"why": "行的前缀位放头像时用头像组件;列表只负责行的骨架"
},
{
"slug": "mobile-collapse",
"why": "行点击后要就地展开内容用折叠面板;跳转到新页面用列表的可点行"
}
]
}</code></pre></div>
</details>
</section>
<footer class="m-foot">
<p>生成物:本页由 <code>node tools/build-mobile.mjs</code> 从契约 <code>components/mobile-list.json</code> 与 6 端源码生成,请勿手改。</p>
<p>规格原文:<code>.design_library/kole-ui-mobile/spec/移动端规格.md</code> · 隔离门禁:<code>node tools/verify-mobile-isolation.mjs</code></p>
</footer>
</main>
</div>
<script>
(function () {
/* 左栏:≤1000px 默认收起(手机上不让导航占满一屏),跨断点时同步一次;不监听 resize,
免得跟用户手动的展开/收起抢状态。桌面不设 open 之外的动作。 */
var side = document.querySelector('details.m-side');
if (side && window.matchMedia) {
var mq = window.matchMedia('(max-width: 1000px)');
var sync = function () { if (mq.matches) side.removeAttribute('open'); else side.setAttribute('open', ''); };
sync();
if (mq.addEventListener) mq.addEventListener('change', sync);
else if (mq.addListener) mq.addListener(sync);
}
/* 单演示预览帧按内容高度自适应(同源可读 contentDocument;上限 360px、下限 140px)。
固定高度会在内容少的演示上留一大片空白(实测 SwipeCell 单个演示只用 ~120px)。 */
function fitDemoFrames() {
var frames = document.querySelectorAll('.m-demo-stage iframe');
Array.prototype.forEach.call(frames, function (f) {
var fit = function () {
try {
var d = f.contentDocument;
if (!d || !d.body) return;
/* 只量 body.scrollHeight:documentElement.scrollHeight 等于**帧视口高度**(html 撑满视口),
拿它做 max 会形成「帧高→视口高→量到的高度」反馈环,永远收敛在初始值(实测锁在 308px)。 */
var h = d.body.scrollHeight;
if (!h) h = d.documentElement ? d.documentElement.scrollHeight : 0;
if (!h) return;
f.style.height = Math.min(360, Math.max(140, h + 8)) + 'px';
} catch (e) { /* 跨源或未就绪:保持 CSS 兜底高度 */ }
};
f.addEventListener('load', function () { fit(); setTimeout(fit, 300); });
fit();
});
}
fitDemoFrames();
window.addEventListener('load', fitDemoFrames);
/* 主题模式(三态):与 PC 完全同一约定 —— localStorage[kole-mode] ∈ light|dark|auto,
auto 跟随系统,反色靠 html.kole-dark(令牌文件里已写好该组,两端共用一份令牌)。
用户在 PC 站选夜间,进移动端站也是夜间。 */
var MODE_KEY = 'kole-mode';
var MODE_LABEL = { light: '日间模式', dark: '夜间模式', auto: '自动模式' };
function readMode() {
try { var v = localStorage.getItem(MODE_KEY); if (v === 'light' || v === 'dark' || v === 'auto') return v; } catch (e) {}
return 'auto';
}
function systemDark() {
return !!(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches);
}
function applyMode(mode) {
var dark = mode === 'dark' || (mode === 'auto' && systemDark());
document.documentElement.classList.toggle('kole-dark', dark);
document.documentElement.style.colorScheme = dark ? 'dark' : 'light';
var cur = document.getElementById('m-mode-cur');
if (cur) cur.textContent = MODE_LABEL[mode] || MODE_LABEL.auto;
Array.prototype.forEach.call(document.querySelectorAll('.m-menu-opt'), function (o) {
o.setAttribute('aria-selected', o.getAttribute('data-mode') === mode ? 'true' : 'false');
});
/* 三态图标与 PC 同口径:显式选择时按时态给图标(日间=月亮 / 夜间=太阳),
自动模式下恒为「跟随系统」的显示器图标(此时两个显式图标都不显示)。 */
var moon = document.getElementById('m-icon-moon');
var sun = document.getElementById('m-icon-sun');
var auto = document.getElementById('m-icon-auto');
if (moon) moon.style.display = (mode === 'light') ? '' : 'none';
if (sun) sun.style.display = (mode === 'dark') ? '' : 'none';
if (auto) auto.style.display = (mode === 'auto') ? '' : 'none';
}
function bindModeMenu() {
var trigger = document.getElementById('m-mode-trigger');
var menu = document.getElementById('m-mode-menu');
if (!trigger || !menu) return;
var close = function (refocus) {
menu.classList.add('hidden'); trigger.setAttribute('aria-expanded', 'false');
if (refocus) trigger.focus();
};
trigger.addEventListener('click', function () {
var open = menu.classList.toggle('hidden');
trigger.setAttribute('aria-expanded', open ? 'false' : 'true');
});
trigger.addEventListener('keydown', function (e) {
if (e.key === 'Escape') close(true);
});
Array.prototype.forEach.call(menu.querySelectorAll('.m-menu-opt'), function (opt) {
opt.addEventListener('click', function () {
var mode = opt.getAttribute('data-mode');
try { localStorage.setItem(MODE_KEY, mode); } catch (e) {}
applyMode(mode);
close(true);
});
});
document.addEventListener('click', function (e) {
if (!menu.classList.contains('hidden') && !menu.contains(e.target) && !trigger.contains(e.target)) close(false);
});
document.addEventListener('keydown', function (e) {
if (e.key === 'Escape' && !menu.classList.contains('hidden')) close(true);
});
/* 自动模式下跟随系统切换 */
if (window.matchMedia) {
var mq = window.matchMedia('(prefers-color-scheme: dark)');
var onChange = function () { if (readMode() === 'auto') applyMode('auto'); };
if (mq.addEventListener) mq.addEventListener('change', onChange);
else if (mq.addListener) mq.addListener(onChange);
}
applyMode(readMode());
}
bindModeMenu();
/* 版本下拉:与 PC 顶栏同一实现口径 —— 清单从部署根取(<prefix>/versions.json 与
<prefix>/site/versions.json 两份按序尝试,取有可用条目的那份),拿不到就退回不可点的
纯角标(data-single="1"),不留一个点不开的下拉。
清单不许把用户带去外站:path 只允许 ".."(站点根自身)或 x.y.z 快照目录名。 */
var VERSION_KEY_PATH = '..';
function isValidVersionPath(p) {
if (typeof p !== 'string' || !p.length || p.indexOf('\\') >= 0 || p.indexOf('//') >= 0) return false;
if (p === VERSION_KEY_PATH) return true;
return /^\d+\.\d+\.\d+$/.test(p);
}
/* 清单里的 path 相对部署根,".." = /site/、x.y.z = /x.y.z/site/。
当前页可能不在部署根下(快照页),故先还原部署根绝对路径再算回相对当前页。 */
function versionHref(absSite) {
var i = location.pathname.indexOf('/site/');
var prefix = i >= 0 ? location.pathname.slice(0, i) : '';
if (!prefix || absSite.indexOf(prefix + '/') !== 0) return absSite;
var rest = absSite.slice(prefix.length + 1);
var up = '';
var segs = prefix.slice(1).split('/');
for (var k = 0; k < segs.length; k++) up += "../";
return up + rest;
}
function buildVersionList(doc) {
var raw = doc && doc.versions;
if (!raw || !raw.length) return [];
var i = location.pathname.indexOf('/site/');
var prefix = i >= 0 ? location.pathname.slice(0, i) : '';
var list = [];
for (var k = 0; k < raw.length; k++) {
var v = raw[k] || {};
var ver = v.version ? String(v.version) : '';
var path = v.path ? String(v.path) : '';
if (!ver || !isValidVersionPath(path)) continue;
var absSite = (path === VERSION_KEY_PATH ? '' : '/' + path) + '/site/';
list.push({ version: ver, date: v.date ? String(v.date) : '', latest: !!v.latest, href: versionHref(absSite), absSite: absSite, current: false });
}
if (list.length) {
/* 当前版本 = 绝对路径上命中的最长前缀(最具体的那个)——与 PC 的判定一致,
快照页与根站点都能算对。 */
var here = location.pathname;
var best = -1;
for (var j = 0; j < list.length; j++) {
if (here.indexOf(list[j].absSite) === 0 && list[j].absSite.length > best) best = list[j].absSite.length;
}
for (var m = 0; m < list.length; m++) list[m].current = best >= 0 && list[m].absSite.length === best;
if (best < 0 && list[0]) list[0].current = true;
}
return list;
}
function bindVersionMenu() {
var trigger = document.getElementById('m-ver-trigger');
var menu = document.getElementById('m-ver-menu');
var chip = document.getElementById('m-ver');
if (!trigger || !menu) return;
var close = function (refocus) {
menu.classList.add('hidden'); trigger.setAttribute('aria-expanded', 'false');
if (refocus) trigger.focus();
};
var interactive = false;
var render = function (list) {
interactive = !!(list && list.length);
/* 只有清单拿不到才退回纯角标;只要有一版就是下拉(里面至少能看清当前是哪个版本) */
trigger.setAttribute('data-single', interactive ? '0' : '1');
if (!interactive) { menu.classList.add("hidden"); return; }
var cur = null;
for (var k = 0; k < list.length; k++) if (list[k].current) cur = list[k];
if (chip) chip.textContent = 'v' + ((cur && cur.version) || VERSION);
/* 重建选项(幂等:重复调用不会叠加) */
Array.prototype.slice.call(menu.querySelectorAll('.m-ver-opt')).forEach(function (n) { n.remove(); });
list.forEach(function (it) {
var opt = document.createElement('button');
opt.type = 'button'; opt.className = 'm-ver-opt'; opt.setAttribute('role', 'option');
opt.setAttribute('data-version', it.version);
opt.setAttribute('aria-selected', it.current ? 'true' : 'false');
var tag = it.current ? '当前浏览' : (it.latest ? '最新版' : (it.date || ''));
opt.innerHTML = '<span class="m-ver-opt-num">v' + it.version + '</span><span class="m-ver-opt-tag">' + tag + '</span>';
if (it.href) opt.setAttribute('data-href', it.href);
opt.addEventListener("click", function () {
if (!it.current && it.href) location.href = it.href;
else close(true);
});
menu.appendChild(opt);
});
};
trigger.addEventListener('click', function () {
if (!interactive) return;
if (menu.classList.contains('hidden')) { menu.classList.remove('hidden'); trigger.setAttribute('aria-expanded', 'true'); }
else close(false);
});
trigger.addEventListener('keydown', function (e) {
if (!interactive) return;
if (e.key === 'ArrowDown' || e.key === 'ArrowUp') { e.preventDefault(); menu.classList.remove('hidden'); trigger.setAttribute('aria-expanded', 'true'); }
else if (e.key === 'Escape') close(true);
});
document.addEventListener('click', function (e) {
if (!menu.classList.contains('hidden') && !menu.contains(e.target) && !trigger.contains(e.target)) close(false);
});
document.addEventListener('keydown', function (e) {
if (e.key === 'Escape' && !menu.classList.contains('hidden')) close(true);
});
/* 两份清单按序尝试(不并行:快照页那份必然 404,并行会把 404 记进控制台,
而站点门禁的「零控制台错误」是硬断言)。 */
if (!window.fetch || location.protocol === 'file:') return;
var i = location.pathname.indexOf('/site/');
if (i < 0) return;
var prefix = location.pathname.slice(0, i);
var urls = [prefix + '/versions.json', prefix + '/site/versions.json'];
var attempt = function (idx) {
if (idx >= urls.length) return;
fetch(urls[idx], { cache: 'no-store' })
.then(function (r) { if (!r.ok) throw new Error('HTTP ' + r.status); return r.json(); })
.then(function (doc) { var list = buildVersionList(doc); if (list.length) render(list); else attempt(idx + 1); })
.catch(function () { attempt(idx + 1); });
};
attempt(0);
}
bindVersionMenu();
function done(btn) {
var old = btn.textContent; btn.textContent = '已复制'; btn.classList.add('is-done');
setTimeout(function () { btn.textContent = old; btn.classList.remove('is-done'); }, 1200);
}
document.addEventListener('click', function (e) {
var btn = e.target && e.target.closest ? e.target.closest('.m-copy') : null;
if (!btn) return;
var src = document.getElementById(btn.getAttribute('data-copy') || '');
var text = src ? (src.innerText || src.textContent || '') : '';
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(text).then(function () { done(btn); }, function () { fallback(btn, text); });
} else { fallback(btn, text); }
});
function fallback(btn, text) {
try {
var ta = document.createElement('textarea'); ta.value = text; ta.setAttribute('readonly', '');
ta.style.position = 'fixed'; ta.style.opacity = '0'; document.body.appendChild(ta);
ta.select(); document.execCommand("copy"); document.body.removeChild(ta); done(btn);
} catch (err) { btn.textContent = '复制失败'; }
}
})();
</script>
</body>
</html>