翻譯進行中
本頁尚未翻譯為繁體中文,以下顯示簡體中文原文。範例的預設元件文字仍使用繁體中文。
Loading 加载
展示行内或全屏加载状态。
引入
uni-app 配置 easycom 后使用 <hui-loading>;公开类型从 @nscode/handy-uni 导入。普通 Vue 3 项目安装 @nscode/handy-uni/web 预览版插件后使用同名组件。
示例
操作控件后,页面直接显示当前值和事件结果。
vue
<template>
<view>
<hui-loading text="加载中 / Loading" />
<hui-loading type="spinner" :size="28" vertical text="处理中 / Processing" /><hui-loading
type="circular"
:size="20"
color="var(--hui-color-primary)"
/>
<text>{{ lastEvent }}</text>
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue'
const lastEvent = ref('尚无事件')
</script>
Props
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
type | LoadingType | 'circular' | 样式 |
size | string | number | 20 | 图标尺寸,数字按 px |
color | string | — | 不传时用 --hui-color-primary |
text | string | — | 说明文字;不传时只读屏读 t('common.loading') |
vertical | boolean | false | 文字在图标下方 |
fullscreen | boolean | false | 铺满父容器并居中(父容器要 position: relative) |
根节点属性见通用属性。布尔默认值为 undefined 时支持继承;显式 false 会覆盖继承值。其他布尔值按表中默认值处理。
Events
无。
Slots
| 插槽 | 参数 | 说明 |
|---|---|---|
icon | — | 自定义 icon 区域,覆盖默认内容。 |
default | — | 主体内容。 |
方法
无。
类型
LoadingProps、LoadingType 可从 @nscode/handy-uni 导入。
ts
export type LoadingType = 'spinner' | 'circular'
平台说明
| 行为 | uni-app H5 | 微信小程序 | App-vue | 普通 Vue 3 Web(预览) |
|---|---|---|---|---|
| 基本交互 | 已实现,待设备复核 | 已实现,待设备复核 | 已实现,待设备复核 | 由 Web 平台适配层实现 |
设备操作见冒烟清单。真实设备读数单独记录,单元测试通过不代表真机验收。