<template>
	<view>
		<view v-if="listlen==0">
			<view class="_vlistnodata">
				<image v-if="nodataimg" :src="nodataimg" mode="widthFix" />
				<view>{{nodatamsg?nodatamsg:lang('list.nodatamsg')}}</view>
			</view>
		</view>
		<view class="_vlistend" v-if="listlen > 0 && page < 0">———— ● ————</view>
		<view class="_obs_listend"></view>
	</view>
</template>

<script>
	export default {
		emits: ['show'],
		props: {
			listlen: {
				type: Number,
				default: 0
			},
			page: {
				type: Number,
				default: 0
			},
			nodatamsg: {
				type: String
			},
			nodataimg: {
				type: String,
				default: ''
			}
		},
		data() {
			return {};
		},
		mounted() {
			this.observer = uni.createIntersectionObserver(this, {
				nativeMode: true
			});
			this.observer.relativeToViewport();
			this.observer.observe('._obs_listend', res => {
				if (res.intersectionRatio == 1) {
					this.$emit('show');
				}
			});
		},
		unmounted() {
			this.observer.disconnect();
		},
		methods: {}
	}
</script>
<style scoped>
	._vlistnodata {
		text-align: center;
		padding: 1em;
		font-size: 1.2em;
	}

	._vlistend {
		position: relative;
		text-align: center;
		color: var(--txt1);
		font-size: 0.8em;
		padding: 1em;
		margin-bottom: 1em;
	}

	._obs_listend {
		width: 100%;
		height: 1px;
	}
</style>