首先,放一個weex中loadmore使用的demo,可以看一下http://dotwe.org/vue/8dd2a10c69e149ae8971f8298cc8bebf
1.在list標簽上添加 @loadmore = “liadmore”
<list @loadmore="loadmore" class="scrollRight" loadmoreoffset="10" ref="scroll" :style="{height:(getHeight - getIOSHeight -getHeightHeader)+'px',paddingBottom:isIos?'0px':'98px'}"> <youtil-refresh :width="'590px'" @URefresh="onRefresh" ref="refresh"></youtil-refresh> <cell class="rightBox" v-for="(item, index) in proList" v-if="listIndex==-1"> <div class="proBox" @click="goDetail(item.goodsId)"> <image class="proImg" resize="contain" :src="item.imgUrl+'&x-oss-process=image/resize,w_164'"></image> <div class="wordBox"> <text class="word ellipsis2">{{item.goodsName}}</text> </div> </div> </cell> </list>
2.寫loadmore的方法,內容主要是圖片列表拉到底要添加的內容
有一點需要注意,如上代碼中,我的需求是循環cell中的div,但是如果把v-for寫在cell標簽內的div上,loadmore方法的使用就會出現問題