Skip to content

加载动画 ​

页面局部需要加载占位的场景使用(如列表首屏加载、局部区块等待)

纯 CSS 圆环加载组件(src/components/app-loading/index.vue),已在 pages.json 中注册 easycom 规则(^app-loading$),模板中直接使用,无需 import

基础用法 ​

<template>
	<view class="content">
		<!-- 默认用法 -->
		<app-loading />

		<!-- 带文案纵向排列 -->
		<app-loading text="努力加载中" vertical />

		<!-- 自定义颜色与尺寸 -->
		<app-loading color="var(--sar-primary)" size="60rpx" text="加载中" vertical />
	</view>
</template>

API ​

属性 ​

属性名称描述类型默认值是否必填
size圆环尺寸string44rpx否
strokeWidth圆环描边宽度string4rpx否
color圆环与默认文字颜色stringvar(--sar-secondary-color)否
trackOpacity轨道透明度number0.28否
text可选加载文案string''否
textColor文案颜色(默认跟随圆环)string''否
textSize文案字号string26rpx否
vertical是否纵向排列圆环和文案booleanfalse否
rootClass根节点附加类名string''否
rootStyle根节点附加样式string | Record<string, string | number>''否