Appearance
List 列表 · API 参考
标签
<qtx-list>;类型java-bridge;事实层 TS 类型 / Vue SFC / Java 注解。使用说明与示例见组件文档。 本页由npm run docs:gen从源码自动生成,禁止手工编辑。
属性(Props · 16)
| 属性名 | 类型 | 必填 | 默认值 | 说明 | 事实源 |
|---|---|---|---|---|---|
columns | number | 否 | 1 | 列数:1 = 纵向列表,N = 网格(默认 1;decoration 不改变列数) | ts-types |
decoration | 'none' | 'tv' | QtxDecorationSpec | 否 | - | 内置装饰预设:'none' 保持原行为,'tv' 套用内容边界与间距;也可给数值对象覆盖 | ts-types |
direction | 'vertical' | 'horizontal' | 否 | vertical | 滚动方向(默认 'vertical';'horizontal' 随 M3 提供) | ts-types |
emptyText | string | 否 | - | state=empty 时显示文本,默认「暂无内容」 | ts-types |
errorText | string | 否 | - | state=error 时显示文本,默认「加载失败,点击重试」 | ts-types |
gutter | number | 否 | 0 | 单元格间距(px,默认 0;显式写 >0 时覆盖 decoration 预设里的卡间值) | ts-types |
initData | string | 否 | - | 原生直通属性(内部):{"templates":[...],"items":[...]} 原子初始化载荷。 由组件内部捕获管线生成,业务侧无需传。 | ts-types |
initialFocusIndex | number | 否 | 0 | 初始焦点行索引(默认 0) | ts-types |
itemAspectRatio | number | 否 | - | 单元格宽高比(与 columns 共同推导高度) | ts-types |
itemHeight | number | 否 | - | 单元格定高(px,网格必填或与 itemAspectRatio 二选一) | ts-types |
items | QtxListItem[] | 否 | - | 行数据(普通响应式数组,可直接变更;捕获期可后置填充) | ts-types |
keyField | string | 否 | id | itemId 锚点字段名(默认 'id';缺失时组件按索引生成稳定 id) | ts-types |
loadingTail | boolean | 否 | - | B2-1:loading 尾卡开关(C 方案)。开启时 load-more 触发自动显示尾卡、数据到达自动隐藏;默认关闭 | ts-types |
loadingText | string | 否 | - | state=loading 时显示文本,默认「加载中…」 | ts-types |
pageEnabled | boolean | 否 | false | 启用触底分页(触发 load-more 事件,默认 false) | ts-types |
state | 'ready' | 'loading' | 'empty' | 'error' | string | 否 | ready | 内容状态:ready 用 items;loading / empty / error 由组件内部生成状态行。同一列表换 items,不切换节点类型,业务无需在 qtx-tab-content 里写 v-if。默认 ready | ts-types |
事件(Events · 11)
| 事件名 | 载荷参数 | 说明 | 事实源 |
|---|---|---|---|
@capture-diagnostics | — | - | vue-sfc |
@item-bind | — | - | ts-types |
@item-click | — | - | ts-types+vue-sfc |
@item-focus | — | - | ts-types+vue-sfc |
@item-unbind | — | - | ts-types |
@load-more | — | - | ts-types+vue-sfc |
@nested-item-click | — | - | vue-sfc |
@nested-item-focus | — | - | vue-sfc |
@onItemEvent | — | - | vue-sfc |
@portal-viewport-enter | — | - | vue-sfc |
@portal-viewport-leave | — | - | vue-sfc |
方法(Methods / Expose · 13)
| 方法名 | 参数 | 返回值 | 说明 | 事实源 |
|---|---|---|---|---|
addListData | items: QtxListItem[] | Promise<void> | 追加数据(APPEND_SUB_ITEMS) | ts-types |
clearItems | — | Promise<void> | 清空列表(等价 setListData([]),空数据走同实例反射清空) | ts-types |
dispatchAction | actions: unknown | void | 通用指令入口(当前实现等价全量刷新) | ts-types |
focusItem | index: number | Promise<void> | 滚动到可见并聚焦指定行(TAB 切换后落列表首项的官方姿势) | ts-types |
getNativeNode | — | any | 取原生节点代理(Base→gate→$el,带 nodeId) | ts-types+vue-sfc |
moveItemBefore | from: number, to: number | void | 移动行到目标行之前;from/to 以当前 items 序为准,业务须在改本地数组前调用 | ts-types |
prependItems | items: QtxListItem[] | void | 头部插入(下拉刷新语义);业务须同步维护本地数组,结构性操作走重建 | ts-types |
refresh | — | void | 以下发数据整体刷新(重建通道) | ts-types |
removeItem | index: number | Promise<void> | 删除指定行;删除前把焦点迁移到相邻幸存行,避免焦点抖动 | ts-types |
scrollToIndex | index: number, smooth?: boolean | Promise<void> | 滚动到指定行(smooth=false 立即定位) | ts-types |
setListData | items: QtxListItem[] | Promise<void> | 全量重设(以传入数组为权威快照;空数组即清空;替换 :items 引用可回到 props 驱动) | ts-types |
setLoading | visible: boolean | Promise<void> | 手动控制 loading 尾卡;hasMore=false 时置 false 可抑制触底反复重显 | ts-types |
updateItem | index: number, patch: Partial<QtxListItem> | Promise<void> | 单行增量更新(等价 items[index] 局部赋值,走 UPDATE_ITEM) | ts-types |
插槽(Slots · 3)
| 插槽名 | 说明 | 事实源 |
|---|---|---|
default | 默认内容插槽,承载组件子内容 | js/qtx/src/components/QtxList/QtxListBase.vue |
item | 列表行模板插槽,作用域参数包含 item / index | docs-site/components/qtx-list/examples/basic.vue |
portals | Portal 活内容挂载插槽,需配合 v-portal-to 使用 | js/qtx/src/components/QtxList/QtxList.vue |
事实源
js/qtx/src/components/QtxList/types.tsjs/qtx/src/components/QtxList/QtxList.vuejs/qtx/src/components/QtxList/QtxListBase.vueandroid/qtx-list/src/main/java/com/quicktvui/qtx/list/QtxListView.java
java= Android@QtProp/@QtEvent/@QtMethod;ts-types=types.ts的 TSDoc;vue-sfc= SFC 内联defineProps/defineEmits/defineExpose;vue-options= Options API 的props声明。 同一属性多源存在时合并,说明取第一个非空值。若实现中存在本表未列出的方法,应补类型或注解,不应在文档中补写表格。