Skip to content

空状态 xEmpty


在线预览
在线模拟尺寸:

介绍

主要用于列表加载页面或者空状态页面时使用。

平台兼容

H5andriodIOS小程序UTSUNIAPP-X SDKversion
☑️☑️☑️☑️4.44+1.1.9

文件路径

ts

@/uni_modules/tmx-ui/components/x-empty/x-empty.uvue

使用

ts

<x-empty></x-empty>

Props 属性

名称说明类型默认值
loading加载状态booleantrue
empty是否为空booleanfalse
error错误状态booleanfalse
more是否有更多数据状态booleanfalse
moreLabel没有数据时的提示,用于加载更多数据时<br>,没有更多数据啦string""
errorLabel列表加载出错时,出错啦~string""
btnLabel按钮文本,点击重试string""
btnColor按钮颜色,默认取全局值string""
btnTextColor按钮文本颜色,默认自动string""
title空或者加载出错时的标语,当前没有数据string""
src图片路径string"/static/tmui4xLibs/static/empty.png"
showBtn是否显示重试按钮booleantrue

Events 事件

名称参数说明
click-刷新按钮被点击时触发

Slots 插槽

名称说明数据
default按钮位置的插槽-

Ref 方法

名称参数返回值说明

示例文件路径

json

/pages/zhanshi/empty

示例源码

uvue
vue
<template>
	<!-- #ifdef APP -->
	<scroll-view style="flex:1">
	<!-- #endif -->
	<!-- #ifdef MP-WEIXIN -->
	<page-meta :page-style="`background-color:${xThemeConfigBgColor}`">
		<navigation-bar :background-color="xThemeConfigNavBgColor" :front-color="xThemeConfigNavFontColor"></navigation-bar>
	</page-meta>
	<!-- #endif -->

		<x-sheet>
			<x-text font-size="18" class=" text-weight-b mb-8">空状态 xEmpty</x-text>
			<x-text color="#999999" >主要用于列表加载页面或者空状态页面时使用,这是根据实际页面加载场景时最常用的状态设计。包括:错误,加载,空,没有更多。综合展现</x-text>
			<x-text color="#999999" >使用时本组件应该放在列表数据的后面。</x-text>
	
			<view class="mt-32 flex flex-row">
				<x-button class="flex-1" @click="loading=true;empty=false;error=false;more=false" >加载中</x-button>
				<x-button class="ml-12 flex-1 " @click="loading=false;empty=true;error=false;more=false" >空时</x-button>
				<x-button class="ml-12 flex-1" @click="loading=false;empty=false;error=true;more=false" >出错时</x-button>
				<x-button class="ml-12 flex-1" @click="loading=false;empty=false;error=false;more=true" >没有了</x-button>
			</view>
		</x-sheet>

		<x-empty :loading="loading" :empty="empty" :error="error" :more="more"></x-empty>
	<!-- #ifdef APP -->
	</scroll-view>
	<!-- #endif -->
</template>

<script>
	export default {
		data() {
			return {
				loading: true,
				empty: false,
				error: false,
				more: false
			};
		}
	}
</script>

<style lang="scss">

</style>
最近更新