<!-- 滚动加载的list -->
<template>
	<view class="zs-list" :style="{marginTop:mt}">
			<slot></slot>
		<zs-load-more class="more" :status="status" :contentText="contentText" />
	</view>
</template>

<script>
	export default {
		props: {
			mt: {
				type: String,
				default: '100rpx'
			},
			status: {
				type: String,
				default: 'more'
			},
			contentText: {
				type: Object,
				default: ()=>{
					return {contentdown: "上拉显示更多",contentrefresh: "正在加载...",contentnomore: "没有更多数据了"}
				}
			},
			
		},
		data() {
			return {
				Observer: null, //监听相交对象
			}
		},
		methods: {
	
		},
		onReady() {
			this.Observer = uni.createIntersectionObserver(this)
			this.Observer.relativeToViewport({
				bottom: 0
			}).observe('.more', (res) => {
				if (this.status == 'loading' || this.status == 'noMore') return
					this.$emit('load')
			})
		},
		beforeDestroy() {
			this.Observer.disconnect()
		}
	}
</script>

<style lang="scss" >
.zs-list{
		// height: calc(100vh - 100rpx);
		// overflow: auto;
		// margin-top: 100rpx;
	
		.more{
			width: 100%;
			
		}
}
</style>