2***@qq.com
2***@qq.com
  • 发布:2022-11-15 16:45
  • 更新:2022-11-15 16:56
  • 阅读:124

vue3 nvue下 waterfall遇到问题

分类:nvue
  • 下图是正常的表现:

  • 下图是上拉刷新后,返回头部的表现

    <template>  
    <view v-bind:style="{'height':windowHeight +'px'}">  
        <waterfall ref="fall" column-count="2" column-width="auto" @loadmore="loadMore()">  
    
            <cell style="width: 750rpx;">  
                <view style="width: 750rpx;height: 400rpx; background-color: red;">  
             </view>  
            </cell>  
            <header style="position:sticky; top: 0px;">  
                    <view>  
                        <text>adfafasdfasdfadfasdfasdfadfasdfasfasdf</text>  
                    </view>  
                    <view>  
                        <text>adfafasdfasdfadfasdfasdfadfasdfasfasdf</text>  
                    </view>  
                    <view>  
                        <text>adfafasdfasdfadfasdfasdfadfasdfasfasdf</text>  
                    </view>  
                    <view>  
                        <text>adfafasdfasdfadfasdfasdfadfasdfasfasdf</text>  
                    </view>  
                    <view>  
                        <text>adfafasdfasdfadfasdfasdfadfasdfasfasdf</text>  
                    </view>  
                    <view>  
                        <text>adfafasdfasdfadfasdfasdfadfasdfasfasdf</text>  
                    </view>  
            </header>  
            <cell v-for="(item, index) in dataList" >  
              <image :src="item.mainPic"></image>  
            </cell>  
            <loading>  
                <text>下拉刷新</text>  
            </loading>  
    
          </waterfall>  
    </view>  
    </template>

    求各位大佬帮忙看看,谢谢!

2022-11-15 16:45 负责人:无 分享
已邀请:
2***@qq.com

2***@qq.com (作者)

自己解决吧
其实只要把顶上的 那个cell 换做header就可以了

2***@qq.com

2***@qq.com (作者)

代码贴上,waterfall +吸顶+swiper

<template>  
    <view v-bind:style="{'height':windowHeight +'px'}">  
        <waterfall ref="fall" column-count="2" column-width="auto" @loadmore="loadMore()">  

            <header>  
                <!-- <view style="width: 750rpx;height: 400rpx; background-color: red;"> -->  
                <swiper :indicator-dots="indicator_dots" :autoplay="autoplay" :circular="circular" :vertical="vertical">  
                    <swiper-item v-for="(item,index) in list" :key="item.id">  
                        <view>  
                            <!-- <image :src="item.url" style="width: 100%;height: 280rpx;"></image> -->  
                            <image :src="item.url" style="width: 750;"></image>  
                        </view>  
                    </swiper-item>  
                </swiper>  
             <!-- </view> -->  
            </header>  
            <header style="position:sticky; top: 0px;">  
                    <view>  
                        <text style="background-color: aquamarine;">这里是自定义导航 还带吸顶~~~~~~~~~~~</text>  
                    </view>  

            </header>  
            <cell v-for="(item, index) in dataList" >  
              <image :src="item.mainPic"></image>  
            </cell>  
            <loading>  
                <text>下拉刷新</text>  
            </loading>  
          </waterfall>  
    </view>  
</template>  

<script>  
    import request from "../../utils/http.js"  
    export default {  
        data() {  
            return {  
                // 是否显示指示器  
                indicator_dots: true,  
                // 自动播放  
                autoplay: true,  
                // 采用衔接动画  
                circular: true,  
                // 否为横向  
                vertical: false,  
                dataList:[],  
                windowHeight: 0,  
                pageNo: 0,  
                pageSize: 30,  
                list2: [{  
                            image: 'https://cdn.uviewui.com/uview/swiper/swiper2.png',  
                            title: '昨夜星辰昨夜风,画楼西畔桂堂东',  
                        },{  
                            image: 'https://cdn.uviewui.com/uview/swiper/swiper1.png',  
                            title: '身无彩凤双飞翼,心有灵犀一点通'  
                        },{  
                            image: 'https://cdn.uviewui.com/uview/swiper/swiper3.png',  
                            title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳'  
                        }],  
                list: [{  
                            id: 1,    
                            url: 'https://cdn.uviewui.com/uview/swiper/swiper2.png',  
                            // title: '昨夜星辰昨夜风,画楼西畔桂堂东',  
                        },{  
                            id: 2,  
                            url: 'https://cdn.uviewui.com/uview/swiper/swiper1.png',  
                            // title: '身无彩凤双飞翼,心有灵犀一点通'  
                        },{  
                            id: 3,  
                            url: 'https://cdn.uviewui.com/uview/swiper/swiper3.png',  
                            // title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳'  
                        }],  
            }  
        },  
        onPullDownRefresh() {  
            console.log("下拉刷新了?");  
            this.loadMore();  
        },  
        onLoad() {  
            this.windowHeight = uni.getSystemInfoSync().windowHeight;  
            this.queryList(this.pageNo,this.pageSize);  
        },  
        methods: {  
            queryList(pageNo,pageSize){  
                request.post('tb/getGoodThing', {  
                    deviceType: getApp().globalData.platform == 'android' ? (getApp().globalData.systemLevel < 10 ? 'IMEI' : 'OAID') :  
                        'IDFA',  
                    deviceValue: '',//getApp().globalData.equipmentNumber,  
                    pageId: pageNo,  
                    pageSize: pageSize,  
                    type: 1  
                }, 'application/json').then((res) => {  
                    if (res.length < 10) {  
                        this.loadingState = false  
                        this.loadstatus = 'normal'  
                    } else {  
                        this.loadstatus = 'loading'  
                        this.loadingState = true  
                    }  
                    // console.log(JSON.stringify(res))  
                    this.dataList = this.dataList.concat(res);  
                    uni.stopPullDownRefresh();  
                })  
            },  
            loadMore(){  
                this.pageNo += 1;  
                this.queryList(this.pageNo,this.pageSize);  
                this.$refs["fall"].resetLoadmore();  
            }  
        }  
    }  
</script>  

<style>  
    .item-image {  
        width: 750rpx;  
        height: 300rpx;  
    }  
</style>  

要回复问题请先登录注册