Appearance
AppIcon 应用图标卡片
模板标签:<qtx-app-icon>
独立应用卡片:由 Android
@QtComponent原生视图与 Vue 透传壳组成,支持三种图标来源、icon/banner静态形态与安装态展示。
<qtx-app-icon> 面向桌面、应用商店与推荐位里的单个应用卡。完整 API 表见 ./api(由 npm run docs:gen 生成),本页只描述使用语义,不复制 Props / Events / Methods 事实表。
图标来源分三支:网络 URL 用 icon / image / imgUrl;本地资源或文件用 localIcon / resName / resId / filePath / assetPath;已安装应用用 packageName,经 PackageManager + LruCache + 后台线程解析。三支失败后统一回退 fallbackIcon。variant=banner 复用 GlintBannerView 字段集(title / subtitle / tag / appTag / appIcon / buttonText / poster / imageUrl / bgColor / type / mediaType / mediaUrl / videoUrl / clickPayload),但只做静态横幅:不启用轮播,不恢复已下架的 banner 内置 item 类型,也不注册 viewType=banner。
适用场景
- 桌面、应用商店、推荐位里独立展示一张应用图标卡
- 需要按
packageName读取已安装应用图标,并配合LruCache降低重复解析开销 - 需要在
icon/banner两种静态形态间切换,展示title/appTag/buttonText等横幅字段 - 需要展示
installState(not_installed/installed/updating/can_update)与下载progress,以及rating/price - 需要
iconResolved/iconLoadError/installStateChange/progressChange/bannerAction等回调 - 需要通过 ref 的
setAppIcon/setIconUrl/setVariant/setBannerData/setInstallState/setProgress/clearIconCache/getState做局部更新
不适用场景
- 成百上千行的长列表逐行创建独立组件实例,应改用列表的 viewType 工厂 + 复用池
- 需要轮播的横幅位;
banner是静态横幅形态,不启用轮播 - 需要拉取或展示全量应用列表;组件只按
packageName单点解析,不缓存应用列表、不上传包名 - 卡片内部需要任意复杂子树布局,应使用 qt-view / qt-text 组合,而不是把复杂结构放入原生卡片
Web 演示
Web 演示浏览器模拟演示 · TV 真机行为以实机为准
应用卡片(点击触发 @click)
来源:url · https://cdn.example.com/icons/demo.png
形态:icon
安装态:not_installed
progress:0%
状态快照
variant:icon
installState:not_installed
rating:4.6 · price:免费
appTag:推荐 · buttonText:安装
banner 为静态横幅,不轮播
事件日志:—
浏览器模拟演示 · TV 真机行为以实机为准
最近事件:—
示例
vue
<template>
<div class="page" :width="1920" :height="1080">
<qtx-app-icon
ref="iconRef"
:icon="iconUrl"
:title="appTitle"
:appLabel="appLabel"
:rating="4.6"
variant="icon"
installState="not_installed"
:width="320"
:height="360"
@click="onCardClick"
@iconResolved="onIconResolved"
@iconLoadError="onIconLoadError"
@installStateChange="onInstallStateChange"
@stateChange="onStateChange"
/>
<div :width="640" :height="80">
<qt-text :text="statusText" :width="640" :height="80" />
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
const iconUrl = ref('https://cdn.example.com/icons/demo.png')
const appTitle = ref('示例应用')
const appLabel = ref('影音 · 4.6 分')
const statusText = ref('就绪:等待图标解析')
const iconRef = ref<{ getState: () => string } | null>(null)
function onCardClick() {
statusText.value = `click → state=${iconRef.value?.getState()}`
}
function onIconResolved() {
statusText.value = `iconResolved → state=${iconRef.value?.getState()}`
}
function onIconLoadError() {
statusText.value = `iconLoadError → fallbackIcon → state=${iconRef.value?.getState()}`
}
function onInstallStateChange() {
statusText.value = 'installStateChange'
}
function onStateChange() {
statusText.value = `stateChange → state=${iconRef.value?.getState()}`
}
</script>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
vue
<template>
<div class="page" :width="1920" :height="1080">
<div :width="1920" :height="420">
<!-- 三种图标来源:网络 URL / 本地资源 / 已安装应用 packageName -->
<qtx-app-icon
:icon="urlIcon"
:title="urlTitle"
variant="icon"
:width="280"
:height="380"
@click="onSourceClick('URL')"
/>
<qtx-app-icon
:localIcon="localIcon"
:title="localTitle"
variant="icon"
:width="280"
:height="380"
@click="onSourceClick('LOCAL_RES')"
/>
<qtx-app-icon
:packageName="packageName"
:title="pkgTitle"
variant="icon"
:width="280"
:height="380"
@iconResolved="onIconResolved"
@iconLoadError="onIconLoadError"
/>
</div>
<div :width="1920" :height="420">
<!-- 失败回退 fallbackIcon -->
<qtx-app-icon
:icon="brokenIcon"
:fallbackIcon="fallbackIcon"
:title="fallbackTitle"
:width="280"
:height="380"
@iconLoadError="onIconLoadError"
/>
<!-- 事件、variant 切换、安装态与 ref 方法主卡片 -->
<qtx-app-icon
ref="cardRef"
:icon="activeIcon"
:fallbackIcon="fallbackIcon"
:title="cardTitle"
:subtitle="cardSubtitle"
:appTag="appTag"
:buttonText="buttonText"
:rating="4.6"
:price="price"
:variant="activeVariant"
:installState="installState"
:progress="progress"
:width="280"
:height="380"
@click="onCardClick"
@focus="onFocus"
@blur="onBlur"
@longClick="onLongClick"
@iconResolved="onIconResolved"
@iconLoadError="onIconLoadError"
@installStateChange="onInstallStateChange"
@progressChange="onProgressChange"
@bannerAction="onBannerAction"
@variantChange="onVariantChange"
@stateChange="onStateChange"
@bind="onBind"
@recycle="onRecycle"
@patch="onPatch"
@imageLoadStart="onImageLoadStart"
@imageLoadSuccess="onImageLoadSuccess"
@imageLoadError="onImageLoadError"
/>
</div>
<div :width="1920" :height="80">
<div :width="240" :height="70" @click="switchSource">
<qt-text :text="sourceLabel" :width="240" :height="70" />
</div>
<div :width="240" :height="70" @click="switchVariant">
<qt-text :text="variantLabel" :width="240" :height="70" />
</div>
<div :width="240" :height="70" @click="useFallback">
<qt-text text="触发回退" :width="240" :height="70" />
</div>
<div :width="240" :height="70" @click="switchInstall">
<qt-text :text="installState" :width="240" :height="70" />
</div>
<div :width="240" :height="70" @click="addProgress">
<qt-text text="进度 +20" :width="240" :height="70" />
</div>
<div :width="240" :height="70" @click="clearCache">
<qt-text text="清缓存" :width="240" :height="70" />
</div>
</div>
<div :width="1200" :height="60">
<qt-text :text="statusText" :width="1200" :height="60" />
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
const urlIcon = ref('https://cdn.example.com/icons/demo.png')
const localIcon = ref('res://mipmap/ic_launcher')
const packageName = ref('com.example.tv.demo')
const brokenIcon = ref('https://cdn.example.com/icons/broken.png')
const fallbackIcon = ref('https://cdn.example.com/icons/fallback.png')
const activeIcon = ref(urlIcon.value)
const urlTitle = ref('网络 URL 图标')
const localTitle = ref('本地资源图标')
const pkgTitle = ref('已安装应用')
const fallbackTitle = ref('失败回退示例')
const cardTitle = ref('交互中枢')
const cardSubtitle = ref('支持 icon / banner')
const appTag = ref('推荐')
const buttonText = ref('安装')
const price = ref('免费')
const activeVariant = ref('icon')
const installState = ref('not_installed')
const progress = ref(0)
const statusText = ref('就绪')
const sourceLabel = ref('来源:URL')
const variantLabel = ref('形态:icon')
const cardRef = ref<{
setAppIcon: (src: string) => void
setLocalIcon: (src: string) => void
setIconUrl: (src: string) => void
setVariant: (v: string) => void
setBannerData: (d: Record<string, unknown>) => void
setInstallState: (s: string) => void
setProgress: (p: number) => void
setRatingAndPrice: (r: number, p: string) => void
setLabel: (l: string) => void
applyPatch: (p: Record<string, unknown>) => void
clearIconCache: () => void
requestFocus: () => void
clear: () => void
recycle: () => void
getState: () => string
cancelImageLoad: () => void
} | null>(null)
function onSourceClick(s: string) {
statusText.value = `图源分支:${s}(URL / LOCAL_RES / packageName)`
}
function switchSource() {
const seq = ['URL', 'LOCAL_RES', 'packageName']
const cur = sourceLabel.value.replace('来源:', '')
const next = seq[(seq.indexOf(cur) + 1) % seq.length]
sourceLabel.value = `来源:${next}`
if (next === 'URL') {
activeIcon.value = urlIcon.value
cardRef.value?.setIconUrl(urlIcon.value)
} else if (next === 'LOCAL_RES') {
activeIcon.value = localIcon.value
cardRef.value?.setLocalIcon(localIcon.value)
} else {
activeIcon.value = ''
cardRef.value?.setAppIcon(packageName.value)
}
cardRef.value?.setLabel(`当前来源:${next}`)
statusText.value = `切换到 ${next} 来源 → state=${cardRef.value?.getState()}`
}
function switchVariant() {
activeVariant.value = activeVariant.value === 'icon' ? 'banner' : 'icon'
variantLabel.value = `形态:${activeVariant.value}`
cardRef.value?.setVariant(activeVariant.value)
if (activeVariant.value === 'banner') {
cardRef.value?.setBannerData({ title: '横幅标题', subtitle: '静态横幅,不轮播', buttonText: '立即打开', appTag: '限时' })
}
statusText.value = `setVariant(${activeVariant.value}) → state=${cardRef.value?.getState()}`
}
function useFallback() {
activeIcon.value = brokenIcon.value
cardRef.value?.setIconUrl(brokenIcon.value)
statusText.value = `等待 iconLoadError → fallbackIcon 回退;state=${cardRef.value?.getState()}`
}
function switchInstall() {
const seq = ['not_installed', 'installed', 'updating', 'can_update']
const next = seq[(seq.indexOf(installState.value) + 1) % seq.length]
installState.value = next
cardRef.value?.setInstallState(next)
cardRef.value?.setRatingAndPrice(4.6, next === 'installed' ? '已安装' : '免费')
statusText.value = `setInstallState(${next}) → state=${cardRef.value?.getState()}`
}
function addProgress() {
progress.value = Math.min(100, progress.value + 20)
cardRef.value?.setProgress(progress.value)
statusText.value = `setProgress(${progress.value}) → progressChange`
}
function clearCache() {
cardRef.value?.clearIconCache()
cardRef.value?.cancelImageLoad()
cardRef.value?.clear()
statusText.value = `clearIconCache + clear → state=${cardRef.value?.getState()}`
}
function onCardClick() {
statusText.value = `click → ${cardRef.value?.getState()}`
}
function onFocus() {
statusText.value = 'focus'
}
function onBlur() {
statusText.value = 'blur'
}
function onLongClick() {
cardRef.value?.applyPatch({ appTag: '长按' })
statusText.value = `longClick → applyPatch → ${cardRef.value?.getState()}`
}
function onIconResolved() {
statusText.value = `iconResolved → state=${cardRef.value?.getState()}`
}
function onIconLoadError() {
statusText.value = `iconLoadError → fallbackIcon;state=${cardRef.value?.getState()}`
}
function onInstallStateChange() {
statusText.value = `installStateChange → ${installState.value}`
}
function onProgressChange() {
statusText.value = `progressChange → ${progress.value}%`
}
function onBannerAction() {
statusText.value = 'bannerAction'
}
function onVariantChange() {
statusText.value = `variantChange → ${activeVariant.value}`
}
function onStateChange() {
statusText.value = `stateChange → ${cardRef.value?.getState()}`
}
function onBind() {
statusText.value = 'bind'
}
function onRecycle() {
statusText.value = 'recycle'
}
function onPatch() {
statusText.value = 'patch'
}
function onImageLoadStart() {
statusText.value = 'imageLoadStart'
}
function onImageLoadSuccess() {
statusText.value = 'imageLoadSuccess'
}
function onImageLoadError() {
statusText.value = 'imageLoadError'
}
</script>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
示例是仓库里真实的 .vue 文件,由 qtx-tpl-loader 参与编译校验,属性与事件名均取自组件源码。
使用约束与易错点
- 三种图标来源分属不同解析分支:网络别名
icon/image/imgUrl、本地localIcon/resName/resId/filePath/assetPath、已安装应用packageName;失败统一回退fallbackIcon variant取icon/banner;banner复用 GlintBannerView 字段集但不轮播、不恢复已下架的 banner 内置 item 类型、不注册viewType=bannerinstallState取not_installed/installed/updating/can_update;progress与setProgress/progressChange联动packageName查询在后台线程执行,结果回主线程前校验generation,避免 RecyclerView 复用后把 A 应用图标贴到 B 行- 事件名为 camelCase(如
iconResolved、installStateChange、variantChange、imageLoadError),独立组件经@QtEvent→ Vue emit 抛出 - Android 11+ 包可见性需要宿主 AndroidManifest 声明
<queries>或权限;未声明时packageName解析失败并触发iconLoadError后回退
已知边界
- 独立组件不适合在长列表里逐行实例化;长列表请用 viewType 工厂 + RecycledViewPool 复用同一渲染内核
- qtx-tpl-loader 的白名单只约束 qtx-list 的
#item插槽内 DOM 标签,不约束 qtx-* 原生组件标签 - 所有标签必须显式声明 width / height(px)
- Android 11+ 包可见性需声明
<queries>或权限,未声明时packageName会解析失败并触发iconLoadError后回退fallbackIcon banner是静态横幅形态,不轮播、不是已恢复的 banner item 类型,且不注册viewType=banner- 独立组件与列表行的事件通道不同:独立组件走
@QtEvent→ Vue emit(如@click/@iconLoadError),列表行走item-click/item-focus;细粒度事件(variantChange/iconResolved/installStateChange等)载荷含itemId/position/payload,而卡片主体的click在触摸路径由 Hippy 内建 onClick 通道派发、载荷为原生事件对象,两者结构不同 registerElement注册时通过eventNamesMap保留onXxx事件名;自定义 CLI 生成模板时不可移除该映射,否则所有细粒度事件会被框架静默丢弃
验证状态
- 文档编译门禁:docs-check 的示例编译、四表完整性与文风检查通过。
- 真机端到端(192.168.80.21:5555 / Android 9):props、ref 命令式方法、细粒度事件与
click载荷均已取证;逐项证据见docs/QTX_PRESET_ITEMS_DEVICE_CASES.json的deviceRun.independentComponents。 - 事件派发的两个缺陷(输入路由、
eventNamesMap事件名映射)已修复,根因与修法见docs/QTX_CARD_COMPONENTS_PLAN.md§11。 - 尚未覆盖:Android 11+ 包可见性在 11+ 设备复核(当前在线设备均为 Android 9)。
API 参考
以下表格由
npm run docs:gen从源码生成,禁止手工编辑;完整独立页见 AppIcon 应用图标卡片 API。
属性(Props · 37)
| 属性名 | 类型 | 必填 | 默认值 | 说明 | 事实源 |
|---|---|---|---|---|---|
actionPayload | Record<string, any> | 否 | - | 操作按钮事件附带载荷(键值开放,随 bannerAction 事件回传),默认空 | ts-types+vue-sfc+java |
appLabel | string | 否 | - | 应用名称(等价于 title 的应用侧别名),默认空 | ts-types+vue-sfc+java |
appTag | string | 否 | - | 应用标签(角标文案),默认空 | ts-types+vue-sfc+java |
aspectRatio | number | 否 | 1 | 卡片宽高比(宽 / 高),默认 1 | ts-types+vue-sfc+java |
assetPath | string | 否 | - | 图标 assets 路径,默认空 | ts-types+vue-sfc+java |
banner | Record<string, any> | 否 | - | banner 版式数据(键值开放),默认空 | ts-types+vue-sfc+java |
buttonText | string | 否 | - | 操作按钮文案,默认空 | ts-types+vue-sfc+java |
clickPayload | Record<string, any> | 否 | - | 点击事件附带载荷(键值开放,随 click 事件回传),默认空 | ts-types+vue-sfc+java |
cornerRadius | number | 否 | 12 | 卡片圆角半径(px),默认 12 | ts-types+vue-sfc+java |
fallbackIcon | string | 否 | - | 图标解析 / 加载失败时的兜底图,默认空 | ts-types+vue-sfc+java |
filePath | string | 否 | - | 图标文件路径(本地文件),默认空 | ts-types+vue-sfc+java |
focusable | boolean | 否 | true | 是否可获焦,默认 true | ts-types+vue-sfc+java |
focusBorder | boolean | 否 | true | 是否显示获焦描边,默认 true | ts-types+vue-sfc+java |
focusGlow | boolean | 否 | false | 是否显示获焦光晕,默认 false | ts-types+vue-sfc+java |
focusPayload | Record<string, any> | 否 | - | 获焦事件附带载荷(键值开放,随 focus 事件回传),默认空 | ts-types+vue-sfc+java |
focusScale | number | 否 | 1.05 | 获焦缩放倍率,默认 1.05 | ts-types+vue-sfc+java |
height | number | string | 否 | 0 | 卡片高度(数字自动补 px),默认 0 | ts-types |
icon | string | 否 | - | 主图标地址,多来源别名之一(优先级 icon > image > imgUrl),默认空 | ts-types+vue-sfc+java |
iconCornerRadius | number | 否 | 12 | 图标圆角半径(px),默认 12 | ts-types+vue-sfc+java |
iconScaleType | string | 否 | fitCenter | 图标缩放类型(如 fitCenter / centerCrop),默认 fitCenter | ts-types+vue-sfc+java |
image | string | 否 | - | 图标地址别名(优先级次于 icon),默认空 | ts-types+vue-sfc+java |
imgUrl | string | 否 | - | 图标地址别名(优先级最低),默认空 | ts-types+vue-sfc+java |
installState | string | 否 | not_installed | 安装状态(如 not_installed / installing / installed),默认 not_installed | ts-types+vue-sfc+java |
loadingDelayMs | number | 否 | 300 | 加载态延迟显示毫秒数,默认 300 | ts-types+vue-sfc+java |
localIcon | string | 否 | - | 本地图标资源(drawable / assets / file),默认空 | ts-types+vue-sfc+java |
packageName | string | 否 | - | 应用包名(按已安装应用解析图标),默认空 | ts-types+vue-sfc+java |
placeholderColor | string | 否 | - | 占位图背景色,默认 #2E2E2E | ts-types+vue-sfc+java |
price | string | 否 | - | 应用价格文案,默认空 | ts-types+vue-sfc+java |
progress | number | 否 | 0 | 安装 / 下载进度(0-100),默认 0 | ts-types+vue-sfc+java |
rating | number | string | 否 | 0 | 应用评分,默认 0 | ts-types+vue-sfc+java |
resId | string | number | 否 | - | Android 资源 ID(R.drawable.xxx / 数字 id),默认空 | ts-types+vue-sfc+java |
resName | string | 否 | - | Android 资源名(按名称解析 drawable),默认空 | ts-types+vue-sfc+java |
span | number | 否 | 1 | 网格跨列数,默认 1 | ts-types+vue-sfc+java |
state | string | 否 | loading | 卡片状态,默认 loading | ts-types+vue-sfc+java |
title | string | 否 | - | 卡片主标题,默认空 | ts-types+vue-sfc+java |
variant | 'icon' | 'banner' | string | 否 | icon | 卡片版式:icon / banner,默认 icon | ts-types+vue-sfc+java |
width | number | string | 否 | 0 | 卡片宽度(数字自动补 px),默认 0 | ts-types |
事件(Events · 34)
| 事件名 | 载荷参数 | 说明 | 事实源 |
|---|---|---|---|
@bannerAction | payload: any | - | ts-types+vue-sfc |
@bind | payload: any | - | ts-types+vue-sfc |
@blur | payload: any | - | ts-types+vue-sfc |
@click | payload: any | - | ts-types+vue-sfc |
@focus | payload: any | - | ts-types+vue-sfc |
@iconLoadError | payload: any | - | ts-types+vue-sfc |
@iconResolved | payload: any | - | ts-types+vue-sfc |
@imageLoadError | payload: any | - | ts-types+vue-sfc |
@imageLoadStart | payload: any | - | ts-types+vue-sfc |
@imageLoadSuccess | payload: any | - | ts-types+vue-sfc |
@installStateChange | payload: any | - | ts-types+vue-sfc |
@longClick | payload: any | - | ts-types+vue-sfc |
@onBannerAction | payload?: any | banner 按钮点击时触发,载荷含 action / index / payload | vue-sfc+java |
@onBind | payload?: any | 内容绑定时触发 | vue-sfc+java |
@onBlur | payload?: any | 卡片失去焦点时触发 | vue-sfc+java |
@onClick | payload?: any | 卡片被点击时触发,载荷含 itemId / position / payload | vue-sfc+java |
@onFocus | payload?: any | 卡片获得焦点时触发 | vue-sfc+java |
@onIconLoadError | payload?: any | 图标解析失败时触发,载荷含 source / kind / reason,应用未安装或资源缺失均会上抛 | vue-sfc+java |
@onIconResolved | payload?: any | 图标解析成功时触发,载荷含 source / kind / packageName / label | vue-sfc+java |
@onImageLoadError | payload?: any | 图源加载失败时触发,载荷含 reason | vue-sfc+java |
@onImageLoadStart | payload?: any | 图源开始加载时触发 | vue-sfc+java |
@onImageLoadSuccess | payload?: any | 图源加载成功时触发 | vue-sfc+java |
@onInstallStateChange | payload?: any | 安装状态变化时触发,载荷含 from / to / packageName | vue-sfc+java |
@onLongClick | payload?: any | 卡片长按时触发 | vue-sfc+java |
@onPatch | payload?: any | 局部刷新完成时触发,载荷含 patchKeys | vue-sfc+java |
@onProgressChange | payload?: any | 下载或安装进度刷新时触发,载荷含 progress / state | vue-sfc+java |
@onRecycle | payload?: any | 回收清理时触发 | vue-sfc+java |
@onStateChange | payload?: any | 状态机迁移时触发,载荷含 from / to | vue-sfc+java |
@onVariantChange | payload?: any | 形态切换时触发,载荷含 from / to | vue-sfc+java |
@patch | payload: any | - | ts-types+vue-sfc |
@progressChange | payload: any | - | ts-types+vue-sfc |
@recycle | payload: any | - | ts-types+vue-sfc |
@stateChange | payload: any | - | ts-types+vue-sfc |
@variantChange | payload: any | - | ts-types+vue-sfc |
方法(Methods / Expose · 18)
| 方法名 | 参数 | 返回值 | 说明 | 事实源 |
|---|---|---|---|---|
applyPatch | patch: Record<string, any> | void | 局部增量更新(按 patch 键原位刷新,不重建) | ts-types+vue-sfc+java |
cancelImageLoad | — | void | 取消当前进行中的图标加载 | ts-types+vue-sfc+java |
clear | — | void | 清空卡片内容 | ts-types+vue-sfc+java |
clearIconCache | packageName?: string | void | 清除图标缓存(传包名清指定应用,不传清全部) | ts-types+vue-sfc+java |
getNativeNode | — | any | 取原生节点代理(Base→gate→$el,带 nodeId) | ts-types+vue-sfc |
getState | — | Promise<QtxAppIconState> | 读取当前卡片状态快照 | ts-types+vue-sfc+java |
if | — | — | - | vue-sfc |
recycle | — | void | 回收并重置卡片(复用前调用) | ts-types+vue-sfc+java |
requestFocus | — | Promise<string> | 请求焦点,返回聚焦结果标识 | ts-types+vue-sfc+java |
setAppIcon | packageName: string | void | 按应用包名解析并切换应用图标 | ts-types+vue-sfc+java |
setBannerData | banner: Record<string, any> | void | 设置 banner 版式数据 | ts-types+vue-sfc+java |
setIconUrl | url: string | void | 切换为网络图标地址 | ts-types+vue-sfc+java |
setInstallState | state: string | void | 设置安装状态 | ts-types+vue-sfc+java |
setLabel | text: string | void | 设置应用名称 / 主标题 | ts-types+vue-sfc+java |
setLocalIcon | src: string, kind?: string | void | 切换为本地图标,kind 指定 drawable / assets / file 等 | ts-types+vue-sfc+java |
setProgress | progress: number | void | 设置安装 / 下载进度(0-100) | ts-types+vue-sfc+java |
setRatingAndPrice | rating: string, price: string | void | 同时设置评分与价格文案 | ts-types+vue-sfc+java |
setVariant | variant: string | void | 切换卡片版式(icon / banner) | ts-types+vue-sfc+java |
插槽(Slots · 1)
| 插槽名 | 说明 | 事实源 |
|---|---|---|
default | 默认内容插槽,承载组件子内容 | js/qtx/src/components/QtxAppIcon/QtxAppIcon.vue |