开箱即用的快应用 ux 组件集合
页面标题栏组件,支持固定和相对定位。
使用示例:
<import name="PageTitleBar" src="quickbox/components/PageTitleBar"></import>
<PageTitleBar
title="我的页面"
show-action="{{true}}"
action-image="/assets/newImages/base/icon.png"
position="fixed"
top-offset="{{70}}"
onaction-click="onActionClick"
/>Props:
title(String): 标题文字showAction(Boolean): 是否显示操作区域actionImage(String): 操作图标URLposition(String): 位置样式,'fixed' | 'relative'topOffset(Number): 顶部偏移量(px)
Events:
action-click: 操作区域点击事件
Slot:
action: 自定义操作区域
返回按钮组件,支持自定义图标和文字。
使用示例:
<import name="BackButton" src="quickbox/components/BackButton"></import>
<BackButton
icon="/assets/newImages/base/back.png"
text="返回"
use-router="{{true}}"
onback-click="onBackClick"
/>Props:
icon(String): 返回图标URLtext(String): 返回文字useRouter(Boolean): 是否使用路由返回
Events:
back-click: 返回按钮点击事件
Slot:
content: 自定义按钮内容
通用卡片组件,支持标题、内容、底部。
使用示例:
<import name="Card" src="quickbox/components/Card"></import>
<Card
title="卡片标题"
content="卡片内容"
footer="底部文字"
clickable="{{true}}"
oncard-click="onCardClick"
>
<div slot="content">
<!-- 自定义内容 -->
</div>
</Card>Props:
title(String): 标题content(String): 内容footer(String): 底部文字clickable(Boolean): 是否可点击
Events:
card-click: 卡片点击事件
Slot:
header: 自定义头部content: 自定义内容footer: 自定义底部
通用列表组件,支持自定义列表项。
使用示例:
<import name="List" src="quickbox/components/List"></import>
<List
title="列表标题"
list="{{listData}}"
loading="{{loading}}"
has-more="{{hasMore}}"
onload-more="onLoadMore"
onitem-click="onItemClick"
>
<div slot="item" item="{{$item}}" index="{{$idx}}">
<!-- 自定义列表项 -->
</div>
</List>Props:
title(String): 列表标题list(Array): 列表数据loading(Boolean): 是否加载中hasMore(Boolean): 是否还有更多defaultImage(String): 默认图片loadMoreMessage(String): 加载更多提示文字
Events:
load-more: 加载更多事件item-click: 列表项点击事件
Slot:
item: 自定义列表项
网格列表组件,适用于视频、图片等内容展示。
使用示例:
<import name="GridList" src="quickbox/components/GridList"></import>
<GridList
title="推荐内容"
list="{{videoList}}"
columns="{{2}}"
loading="{{loading}}"
has-more="{{hasMore}}"
show-mask="{{true}}"
onload-more="onLoadMore"
onitem-click="onItemClick"
/>Props:
title(String): 列表标题list(Array): 列表数据columns(Number): 列数,默认2loading(Boolean): 是否加载中hasMore(Boolean): 是否还有更多showMask(Boolean): 是否显示图片遮罩defaultImage(String): 默认图片
Events:
load-more: 加载更多事件item-click: 列表项点击事件
Slot:
item: 自定义网格项
加载更多组件,用于列表底部。
使用示例:
<import name="ListMore" src="quickbox/components/ListMore"></import>
<ListMore
loading="{{loading}}"
empty="{{!hasMore}}"
message="加载更多"
empty-message="没有更多了"
/>Props:
loading(Boolean): 是否加载中empty(Boolean): 是否为空(没有更多)message(String): 加载中提示文字emptyMessage(String): 空状态提示文字
添加桌面引导组件,支持华为和其他厂商的不同实现。
使用示例:
<import name="AddDesktop" src="quickbox/components/AddDesktop"></import>
<AddDesktop
is-show="{{showAddDesktop}}"
image="{{desktopImage}}"
button-text="添加本剧到桌面,方便下次观看"
bottom="{{120}}"
page-type="20"
add-type="{{6}}"
onadd-click="onAddClick"
onadd-success="onAddSuccess"
onadd-error="onAddError"
/>Props:
isShow(Boolean): 是否显示image(String): 引导图片URLbuttonText(String): 按钮文字bottom(Number): 距离底部距离(px)addType(Number): 添加类型pageType(String): 页面类型
Events:
add-click: 添加点击事件add-success: 添加成功事件add-error: 添加失败事件
分享按钮组件,封装了分享功能。
使用示例:
<import name="ShareButton" src="quickbox/components/ShareButton"></import>
<ShareButton
title="分享标题"
summary="分享摘要"
image-path="/assets/newImages/base/coin.png"
target-url="https://example.com"
platforms="{{['WEIXIN', 'WEIBO']}}"
icon="/assets/newImages/video/share.png"
text="分享"
onshare-success="onShareSuccess"
onshare-error="onShareError"
/>Props:
title(String): 分享标题summary(String): 分享摘要imagePath(String): 分享图片targetUrl(String): 分享链接platforms(Array): 分享平台数组icon(String): 按钮图标text(String): 按钮文字
Events:
share-success: 分享成功事件share-error: 分享失败事件
Slot:
content: 自定义按钮内容
完整的视频播放器组件,支持播放控制、进度显示、封面图等。
使用示例:
<import name="VideoPlayer" src="quickbox/components/VideoPlayer"></import>
<template>
<VideoPlayer
video-id="video_1"
video-url="{{videoUrl}}"
cover-image="{{coverImage}}"
video-info="{{videoInfo}}"
content-info="{{contentInfo}}"
follow-status="{{followStatus}}"
autoplay="{{true}}"
initial-time="{{playedSeconds}}"
onplay="onPlay"
onpause="onPause"
onfinish="onFinish"
onerror="onError"
onshow-section="onShowSection"
onlike="onLike"
onfollow="onFollow"
/>
</template>Props:
videoId(String): 视频ID,用于多个视频实例区分videoUrl(String): 视频URL,必填coverImage(String): 封面图URLvideoInfo(Object): 视频信息对象contentInfo(Object): 内容信息对象followStatus(Boolean): 追剧状态autoplay(Boolean): 是否自动播放initialTime(Number): 初始播放位置(秒)
Events:
play: 播放事件pause: 暂停事件finish: 播放完成事件error: 播放错误事件timeupdate: 时间更新事件prepared: 视频准备完成事件show-section: 显示章节选择like: 点赞事件follow: 追剧事件
Methods:
play(): 播放视频pause(): 暂停视频setCurrentTime(time): 设置播放位置
视频播放控制栏组件,包含播放/暂停按钮、进度条、时间显示。
使用示例:
<import name="VideoControl" src="quickbox/components/VideoPlayer/VideoControl"></import>
<VideoControl
is-play="{{isPlay}}"
media-duration="{{duration}}"
current-time="{{currentTime}}"
onon-start="onStart"
onon-pause="onPause"
/>视频信息栏组件,显示点赞、追剧、选集等操作按钮。
使用示例:
<import name="VideoInfo" src="quickbox/components/VideoPlayer/VideoInfo"></import>
<VideoInfo
video-info="{{videoInfo}}"
content-info="{{contentInfo}}"
follow-status="{{followStatus}}"
onon-like="onLike"
onon-follow="onFollow"
onon-show-section="onShowSection"
/>章节选择组件,支持分组显示和章节选择。
使用示例:
<import name="SectionSelector" src="quickbox/components/SectionSelector"></import>
<SectionSelector
is-show="{{showSectionSelector}}"
content-name="{{contentName}}"
current-section-id="{{currentSectionId}}"
current-section-name="{{currentSectionName}}"
section-list="{{sectionList}}"
page-size="{{30}}"
onclose="onCloseSection"
onchange-section="onChangeSection"
/>Props:
isShow(Boolean): 是否显示contentName(String): 内容名称currentSectionId(String): 当前章节IDcurrentSectionName(String): 当前章节名称sectionList(Array): 章节列表pageSize(Number): 每页显示数量,默认30
Events:
close: 关闭事件change-section: 章节变化事件
完整的小说阅读器组件,支持上下阅读、左右翻页、字号调节、主题切换等。
使用示例:
<import name="Reader" src="quickbox/components/Reader"></import>
<template>
<Reader
content-id="{{contentId}}"
current-chapter-id="{{chapterId}}"
chapter-name="{{chapterName}}"
content="{{content}}"
prev-chapter-id="{{prevChapterId}}"
next-chapter-id="{{nextChapterId}}"
read-type="{{readType}}"
config="{{readerConfig}}"
onback="goBack"
onselect-chapter="onSelectChapter"
onprev-chapter="onPrevChapter"
onnext-chapter="onNextChapter"
onconfig-change="onConfigChange"
onread-type-change="onReadTypeChange"
/>
</template>
<script>
export default {
data: {
readerConfig: {
fontSize: 30,
bgColor: '#ffffff',
textColor: '#333333',
menuBg: '#ffffff',
menuText: '#333333',
lineColor: '#e5e5e5',
theme: 'default'
}
}
};
</script>Props:
contentId(String): 内容ID,必填currentChapterId(String): 当前章节ID,必填chapterName(String): 章节名称content(Array): 章节内容(段落数组)prevChapterId(String): 上一章IDnextChapterId(String): 下一章IDreadType(String): 阅读类型,'vertical'(上下)或 'horizontal'(左右翻页)config(Object): 配置对象
Events:
back: 返回事件select-chapter: 选择章节事件prev-chapter: 上一章事件next-chapter: 下一章事件config-change: 配置变化事件read-type-change: 阅读类型变化事件menu-toggle: 菜单切换事件page-change: 页面变化事件(左右翻页模式)
Methods:
toggleMenus(show): 切换菜单显示
阅读器控制栏组件,包含字号调节、主题切换、翻页方式设置等。
阅读器目录组件,显示章节列表并支持章节选择。
通用的弹窗组件,支持自定义标题、内容、按钮。
使用示例:
<import name="Dialog" src="quickbox/components/Dialog"></import>
<Dialog
is-show="{{showDialog}}"
title="提示"
message="确定要删除吗?"
buttons="{{[
{ text: '取消', color: '#999' },
{ text: '确定', color: '#007AFF', primary: true }
]}}"
show-close="{{true}}"
close-on-backdrop="{{true}}"
onbutton-click="onDialogButtonClick"
onclose="onDialogClose"
/>Props:
isShow(Boolean): 是否显示title(String): 标题message(String): 消息内容buttons(Array): 按钮配置数组showClose(Boolean): 是否显示关闭按钮closeOnBackdrop(Boolean): 点击背景是否关闭
Events:
button-click: 按钮点击事件close: 关闭事件
Slot:
content: 自定义内容插槽
加载提示组件,支持全屏和局部加载。
使用示例:
<import name="Loading" src="quickbox/components/Loading"></import>
<!-- 局部加载 -->
<Loading message="加载中..." />
<!-- 全屏加载 -->
<Loading className="fullscreen" message="加载中..." />
<!-- 黑色背景加载 -->
<Loading className="black" message="加载中..." />Props:
className(String): 自定义类名('fullscreen' | 'black')showSpinner(Boolean): 是否显示加载动画message(String): 提示文字
空状态组件,用于数据为空时的展示。
使用示例:
<import name="Empty" src="quickbox/components/Empty"></import>
<Empty
message="暂无内容"
show-image="{{true}}"
show-button="{{true}}"
button-text="去查看"
onbutton-click="onEmptyButtonClick"
/>Props:
showImage(Boolean): 是否显示图片imageUrl(String): 图片URLmessage(String): 提示文字showButton(Boolean): 是否显示按钮buttonText(String): 按钮文字
Events:
button-click: 按钮点击事件
Slot:
action: 自定义操作区域插槽
支付确认弹窗组件,用于支付过程中的状态确认。
使用示例:
<import name="PayConfirm" src="quickbox/components/PayConfirm"></import>
<PayConfirm
is-show="{{showPayConfirm}}"
order-id="{{orderId}}"
auto-close-time="{{10}}"
oncontinue-pay="onContinuePay"
onpay-done="onPayDone"
onpay-success="onPaySuccess"
onclose="onClosePayConfirm"
/>Props:
isShow(Boolean): 是否显示orderId(String): 订单IDautoCloseTime(Number): 自动关闭时间(秒),0表示不自动关闭
Events:
continue-pay: 继续支付事件pay-done: 支付完成事件pay-success: 支付成功事件close: 关闭事件
阅读器支持以下主题:
default: 白色背景,黑色文字yellow: 米黄色背景green: 绿色背景blue: 蓝色背景black: 黑色背景,白色文字
所有组件都支持通过 class 和 style 属性自定义样式。
- 组件路径:使用相对路径引入组件
- 事件命名:所有事件使用
on前缀(如onplay、onclose) - Props验证:组件会验证必填的props
- 样式隔离:组件样式使用 scoped,不会影响外部样式
- 依赖QuickBox:部分组件依赖 QuickBox API,确保已正确引入
- Slot插槽:组件支持使用 slot 自定义内容
- 样式自定义:所有组件支持通过
class和style属性自定义样式
用于页面布局和导航的组件:
- PageTitleBar: 页面标题栏,支持固定和相对定位
- BackButton: 返回按钮,自动处理路由返回
- Card: 卡片容器,支持标题、内容、底部插槽
用于数据展示的列表组件:
- List: 通用列表,支持自定义列表项
- GridList: 网格列表,适用于视频、图片等内容展示
- ListMore: 加载更多组件,用于列表底部
完整的视频播放解决方案:
- VideoPlayer: 主播放器组件,包含播放控制、进度显示
- VideoControl: 控制栏组件,播放/暂停、进度条
- VideoInfo: 信息栏组件,点赞、追剧、选集等操作
- SectionSelector: 章节选择器,支持分组显示
完整的小说阅读解决方案:
- Reader: 主阅读器组件,支持上下阅读、左右翻页
- ReaderControl: 控制栏组件,字号、主题、翻页方式设置
- ReaderCatalog: 目录组件,章节列表和选择
通用的UI组件:
- Dialog: 弹窗组件,支持自定义标题、内容、按钮
- Loading: 加载组件,支持全屏、局部、黑色背景
- Empty: 空状态组件,可自定义图片、文字、按钮
- PayConfirm: 支付确认弹窗,支持自动关闭
特定功能的组件:
- AddDesktop: 添加桌面引导,自动适配华为和其他厂商
- ShareButton: 分享按钮,封装分享功能
如果需要扩展组件功能,可以:
- 继承现有组件
- 使用
slot插槽自定义内容 - 通过
props传递配置 - 监听组件事件进行自定义处理
查看 使用示例文档 获取详细的代码示例和组合使用场景。