Skip to content
# t-empty

Empty 空状态

t-empty 组件介绍 ​

空白页占位组件,用于在应用中显示一个空状态页面,通常在没有数据或内容可显示时使用。它提供默认或自定义的占位图像,支持自定义标题和描述文本,以及可固定在页面中心的位置。

t-empty 平台兼容 ​

HarmonyH5AndroidiOS小程序UTS
✅✅✅✅✅✅

t-empty 基础用法 ​

基础用法参考 demo/empty/empty.uvue,支持多种占位模式切换。

vue
<template>
	<view>
		<tui-theme-switch></tui-theme-switch>
		<t-card class='m-15'
				title="Empty 空白页占位"
				sub-title="空白页占位组件,用于应用无内容展示场景,如列表为空、搜索无果或请求失败时。可设自定义图像、标题及描述,固定于页面中心,向用户传达状态并指引 。"></t-card>
		<t-empty v-if="area==1"
				 title="暂无数据"
				 desc="功能开发中,敬请期待!"></t-empty>
		<t-empty v-if="area==2"
				 mode="news"
				 title="暂无新消息"
				 class="mt-30"></t-empty>
		<t-empty v-if="area==3"
				 mode="address"
				 title="暂无地址信息"
				 class="mt-30"></t-empty>
		<t-empty v-if="area==4"
				 mode="network"
				 title="请检查网络设置!"
				 class="mt-30"></t-empty>
		<t-empty v-if="area==5"
				 mode="order"
				 title="暂无订单"
				 class="mt-30"></t-empty>
		<t-empty v-if="area==6"
				 mode="search"
				 title="没有找到搜索的内容额~"
				 class="mt-30"></t-empty>
		<view :class="[`fl fww fjcb p-10 m-10 r-10 mt-50 tvg`]">
			<t-button type="primary"
					  class="w-45% mb-15"
					  @click="area=4">请检查网络</t-button>
			<t-button type="primary"
					  class="w-45% mb-15"
					  @click="area=5">暂无订单</t-button>
			<t-button type="primary"
					  class="w-45% mb-15"
					  @click="area=6">无搜索搜索</t-button>
			<t-button type="primary"
					  class="w-45% mb-15"
					  @click="area=1">暂无数据</t-button>
			<t-button type="primary"
					  class="w-45% mb-15"
					  @click="area=2">暂无新消息</t-button>
			<t-button type="primary"
					  class="w-45% mb-15"
					  @click="area=3">暂无地址信息</t-button>
		</view>
	</view>
</template>

<script setup>
	import { ref } from 'vue'
	const area = ref(1)
</script>

t-empty Props ​

属性名类型默认值说明可选值
sizeString"medium"组件尺寸large, medium, small, mini
typeString""组件类型info, primary, error, warning, success
disabledBooleanfalse组件是否禁用true, false
hoverBooleanfalse是否有点击效果true, false
pathString""点击组件后跳转的页面路径-
effectString""组件显示主题normal, dark, light, plain
modeString"order"显示模式order, news, address, network, search
srcString""替换默认图的图片地址-
imageClassString""图片样式-
titleString""标题-
titleClassString""标题的样式-
descrString""描述文本-
descrClassString""描述的文本的样式-
isFixedBooleanfalse是否固定true, false

t-empty Events ​

事件名说明回调参数
click点击时触发-
transitionend动画结束时触发-
initFinished组件初始化完成触发组件的节点信息
touchstart触摸开始时触发触摸事件对象
touchend触摸结束时触发触摸事件对象
touchmove触摸移动时触发触摸事件对象
touchcancel触摸取消时触发触摸事件对象

t-empty Slots ​

插槽名说明
default自定义内容插槽,用于替换默认的空状态内容