1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <!-- 滚动加载的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>
|