<template>
	<view class="empty-content">
		<image class="emptyImg" src="@/static/empty.png"></image>
		<p class="tip">{{text}}</p>
		<button type="primary" class="addBtn" v-if="showBtn" @click="handleAdd">新增</button>
	</view>
</template>

<script>
	export default {
		name: "empty",
		props: {
			text: {
				default: '暂无数据',
				type: String,
			},
			showBtn: {
				default: false,
				type: Boolean,
			},
		},
		data() {
			return {

			};
		},
		methods: {
			handleAdd() {
				this.$emit('onAdd')
			},
		},
	}
</script>

<style lang="scss" scoped>
	.empty-content {
		width: 70%;
		margin-left: 15%;
		margin-top: 40%;
		text-align: center;

		.emptyImg {
			width: 100%;
		}

		.tip {
			font-size: 36rpx;
			color: #666;
		}

		.addBtn {
			width: 40%;
			margin-top: 32rpx;
		}
	}
</style>
