uniapp 微信小程序 数据空白展示组件

效果图

html

javascript 复制代码
<template>
	<view class="nodata">
		<view class="">
			<image class="nodataimg"
				:src="$publicfun.locaAndHttp()?localUrl:$publicfun.httpUrlImg(httUrl)"
				mode="aspectFit"></image>
			<view class="tips">
				{{tips}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "nodata",
		data() {
			return {

			};
		},
		props: {
			tips: {
				default: '暂无数据~',
				type: String
			},
			localUrl: {
				default: '',
				type: String
			},
			httUrl: {
				default: '',
				type: String
			}
		}
	}
</script>

<style lang="scss" scoped>
	.nodata {
		width: 100%;
		height: 500rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		flex-wrap: wrap;

		.nodataimg {
			width: 160px;
			height: 120px;
		}

		.tips {
			width: 100%;
			text-align: center;
			color: #999;
			font-size: 26rpx;
			margin-top: 20rpx;
		}
	}
</style>

关于

定义的全局方法

$publicfun.locaAndHttp() 判断是不是网络路径

localUrl 本地路径

$publicfun.httpUrlImg(httUrl) 网路路径

图片

需求图片

使用

javascript 复制代码
<nodata v-if="orderlist.length==0" :tips="'暂无订单'" :localUrl="'../../static/all/order-empty.png'"
					:httUrl="'order-empty.png'"></nodata>
相关推荐
青企通14 分钟前
传统企业数字化转型的技术路径:从需求建模到小程序 MVP 的落地方法
小程序·php·apache
小皮虾1 小时前
小程序全局状态还能这么简单?只需初始化一次,页面自动同步
前端·javascript·微信小程序
andrsted1 小时前
练题簿助学教学:在线刷题、随堂考试,让一门课拥有自己的题库
学习·微信小程序·小程序·学习方法·刷题
派小心.2 小时前
网站统计多域名数据隔离配置
大数据·数据库·人工智能·小程序·数据分析
2501_915921433 小时前
iOS应用从开发到上架App Store的完整步骤详解
android·ios·小程序·https·uni-app·iphone·webview
省钱兄--zs17 小时前
深圳24小时自助健身房软硬件解决方案实战指南与开发流程详解
java·数据仓库·spring boot·小程序·架构
李洋-蛟龙腾飞公司17 小时前
微信小程序商城迁移鸿元服务实战
微信小程序·小程序
无限聚核20 小时前
抖音 certificate.prepare 之后怎么验券?和美团 msconsume 差在哪,无限聚核
前端·微信小程序
Autumn_ing21 小时前
AI生成应用能做到哪一步?在线问诊APP从挂号到支付的完整案例
小程序·app·健康医疗·ai应用·问诊app·ai生成应用·墨刀ai
火眼金睛记单词1 天前
攻克考研英语熟词僻义:解锁高分密码的关键一步
经验分享·考研·小程序