Skip to content

LoadingPage 加载页

查看 sn-loading-page 的 2.0 版本差异

基础用法

  • 在页面信息尚未完全加载时使用,避免出现视觉空白。
  • 基于全屏遮罩实现,通过 show 属性控制显示与隐藏。
  • 支持 native(内置 loading 组件)与 icon(旋转图标)两种加载指示器模式,传入 img-src 后以图片替代加载指示器。
vue
<template>
	<sn-loading-page :show="show" text="加载中"></sn-loading-page>
</template>

<script setup>
	onLoad(() => {
		// onLoad 内设置延时可以避免组件刚加载的瞬间出现的闪动
		setTimeout(() => {
			show.value = true
		}, 1)
	})
</script>

更多演示请下载 demo 查看

图片模式

传入 img-src 后以图片替代加载指示器,可通过 img-style 控制图片尺寸。

vue
<template>
	<sn-loading-page :show="show" img-src="/static/logo-trans.png" text="SinleUI"
		img-style="width:80px;height:80px;" text-style="margin-top:10px;font-weight:bold;"></sn-loading-page>
</template>

属性

参数说明类型默认值可选值
show是否显示加载页Booleanfalsetrue | false
text加载页显示的文本内容String加载中-
imgSrc加载页显示的图片路径,非空时以图片替代加载指示器String--
bgColor加载页背景颜色,默认主题信息色String--
textColor加载页文本颜色String$primary-
textSize加载页文本大小,默认 $20String | Number--
iconColor加载页图标颜色(如果显示图标),默认跟随 textColorString$primary-
iconSize加载页图标大小(如果显示图标),默认 $38String | Number--
mode加载指示器模式Stringnativenative | icon
aniTime加载页显隐动画时长,支持 $ 简写随动画乘数缩放,0 为瞬时String | Number--
customStyle自定义根节点样式UTSJSONObject | String--
imgStyle自定义图片节点内联样式UTSJSONObject | Stringwidth: 70px; height: 70px;-
imgClass自定义图片节点外部样式类String--
textStyle自定义文本节点内联样式UTSJSONObject | Stringmargin-top: 15px;-
textClass自定义文本节点外部样式类String--

使用 MIT 协议