77 lines
1.6 KiB
Vue
77 lines
1.6 KiB
Vue
<template>
|
|
<view class="mescroll-empty" :class="{ 'empty-fixed': option.fixed }" :style="{ 'z-index': option.zIndex, top: option.top }">
|
|
<view> <image v-if="icon" class="empty-icon" :src="icon" mode="widthFix" /> </view>
|
|
<view v-if="tip" class="empty-tip">{{ tip }}</view>
|
|
<view v-if="option.btnText" class="empty-btn" @click="emptyClick">{{ option.btnText }}</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import GlobalOption from './../mescroll-uni-option.js';
|
|
export default {
|
|
props: {
|
|
option: {
|
|
type: Object,
|
|
default() {
|
|
return {};
|
|
}
|
|
}
|
|
},
|
|
computed: {
|
|
icon() {
|
|
return this.option.icon == null ? GlobalOption.up.empty.icon : this.option.icon; // 此处不使用短路求值, 用于支持传空串不显示图标
|
|
},
|
|
tip() {
|
|
return this.option.tip == null ? GlobalOption.up.empty.tip : this.option.tip; // 此处不使用短路求值, 用于支持传空串不显示文本提示
|
|
}
|
|
},
|
|
methods: {
|
|
emptyClick() {
|
|
this.$emit('emptyclick');
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style>
|
|
.mescroll-empty {
|
|
box-sizing: border-box;
|
|
width: 100%;
|
|
padding: 200rpx 50rpx;
|
|
text-align: center;
|
|
}
|
|
|
|
.mescroll-empty.empty-fixed {
|
|
z-index: 99;
|
|
position: absolute;
|
|
top: 100rpx;
|
|
left: 0;
|
|
}
|
|
|
|
.mescroll-empty .empty-icon {
|
|
width: 300rpx;
|
|
height: 300rpx;
|
|
}
|
|
|
|
.mescroll-empty .empty-tip {
|
|
margin-top: 20rpx;
|
|
font-size: 26rpx;
|
|
color: gray;
|
|
}
|
|
|
|
.mescroll-empty .empty-btn {
|
|
display: inline-block;
|
|
margin-top: 40rpx;
|
|
min-width: 200rpx;
|
|
padding: 18rpx;
|
|
font-size: 28rpx;
|
|
border: 1rpx solid #e04b28;
|
|
border-radius: 60rpx;
|
|
color: #e04b28;
|
|
}
|
|
|
|
.mescroll-empty .empty-btn:active {
|
|
opacity: 0.75;
|
|
}
|
|
</style>
|