Skip to content
本页导读

Loading

组件类型:UxLoadingComponentPublicInstance

支持圆环、菊花形状,可自定义文案

平台兼容性

UniApp X

AndroidiOSweb鸿蒙 Next小程序
x

UniApp Vue Nvue

AndroidiOSweb鸿蒙 Next小程序
xxxx

Props

属性名类型默认值说明
typeStringspinnerloading类型
colorString$ux.Conf.placeholderColorloading颜色
darkColorString深色none-不显示,auto-自动适配深色模式,其他-颜色
sizeAny$ux.Conf.fontSizeloading大小
textColorString文案颜色
textSizeAny$ux.Conf.fontSize文案字体大小
boldBooleanfalse文字加粗
marginArray边距[上右下左][上下左右][上下左右]
mtAny距上单位px
mrAny距右单位px
mbAny距下单位px
mlAny距左单位px
paddingArray填充[上右下左][上下左右][上下左右]
ptAny上内边距单位px
prAny右内边距单位px
pbAny下内边距单位px
plAny左内边距单位px
xstyleArray自定义样式

type

说明
circular圆环
spinner菊花
icon图标

darkColor

说明
none不显示
auto自动适配深色模式
color其他颜色

示例代码

html
<template>
	<ux-page :stack="showDoc">
		<ux-navbar :title="title" :bold="true">
			<template v-slot:right>
				<!-- #ifndef MP -->
				<ux-button theme="text" icon="/static/tip.png" :icon-size="22" @click="onDoc()"></ux-button>
				<!-- #endif -->
			</template>
		</ux-navbar>
		
		<ux-scroll>
			<ux-card direction="column" icon="flag-filled" title="加载中" :bold="true">
				<ux-text text="支持圆环、菊花形状,可自定义文案"></ux-text>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="自定义文本" :bold="true">
				<ux-text text="多种主题可配置,适配暗黑模式" :mb="15"></ux-text>
				<ux-row>
					<ux-loading>Loading</ux-loading>
					<ux-loading color="red" :ml="20">加载中...</ux-loading>
				</ux-row>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="形状" :bold="true">
				<ux-text text="支持禁用按钮,适配暗黑模式" :mb="15"></ux-text>
				<ux-row>
					<ux-loading type="circular">圆环</ux-loading>
					<ux-loading type="spinner" :ml="20">菊花</ux-loading>
				</ux-row>
			</ux-card>
			
			<ux-placeholder :height="200">
				<ux-row justify="center" align="center" style="height: 100%;">
					<ux-text prefix-icon="soapbubble-filled" text="真的没有了~"></ux-text>
				</ux-row>
			</ux-placeholder>
		</ux-scroll>
	</ux-page>
</template>
<template>
	<ux-page :stack="showDoc">
		<ux-navbar :title="title" :bold="true">
			<template v-slot:right>
				<!-- #ifndef MP -->
				<ux-button theme="text" icon="/static/tip.png" :icon-size="22" @click="onDoc()"></ux-button>
				<!-- #endif -->
			</template>
		</ux-navbar>
		
		<ux-scroll>
			<ux-card direction="column" icon="flag-filled" title="加载中" :bold="true">
				<ux-text text="支持圆环、菊花形状,可自定义文案"></ux-text>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="自定义文本" :bold="true">
				<ux-text text="多种主题可配置,适配暗黑模式" :mb="15"></ux-text>
				<ux-row>
					<ux-loading>Loading</ux-loading>
					<ux-loading color="red" :ml="20">加载中...</ux-loading>
				</ux-row>
			</ux-card>
			
			<ux-card direction="column" icon="arrowright" title="形状" :bold="true">
				<ux-text text="支持禁用按钮,适配暗黑模式" :mb="15"></ux-text>
				<ux-row>
					<ux-loading type="circular">圆环</ux-loading>
					<ux-loading type="spinner" :ml="20">菊花</ux-loading>
				</ux-row>
			</ux-card>
			
			<ux-placeholder :height="200">
				<ux-row justify="center" align="center" style="height: 100%;">
					<ux-text prefix-icon="soapbubble-filled" text="真的没有了~"></ux-text>
				</ux-row>
			</ux-placeholder>
		</ux-scroll>
	</ux-page>
</template>
ts
<script setup>
	
	import * as plus from '@/uni_modules/ux-plus'
	
	const title = ref('')
	const showDoc = ref(false)
	
	function onDoc() {
		plus.openWeb({
			title: '在线文档',
			url: 'https://www.uxframe.cn/component/loading.html',
			// blur: 1,
			success: () => {
				showDoc.value = true
			},
			complete: () => {
				showDoc.value = false
			}
		})
	}
	
	onLoad((e: OnLoadOptions) => {
		title.value = e['title'] ?? ''
	})
</script>
<script setup>
	
	import * as plus from '@/uni_modules/ux-plus'
	
	const title = ref('')
	const showDoc = ref(false)
	
	function onDoc() {
		plus.openWeb({
			title: '在线文档',
			url: 'https://www.uxframe.cn/component/loading.html',
			// blur: 1,
			success: () => {
				showDoc.value = true
			},
			complete: () => {
				showDoc.value = false
			}
		})
	}
	
	onLoad((e: OnLoadOptions) => {
		title.value = e['title'] ?? ''
	})
</script>
css
<style lang="scss">
	
</style>
<style lang="scss">
	
</style>