Vant 實現 上拉載入更多

2021-10-09 18:53:36 字數 1345 閱讀 1825

v-model=

"loading"

:finished=

"finished"

:immediate-check=

"false"

finished-text=

"沒有更多了"

@load=

"onload"

:offset=

"10"

>

//itemlist換成你自己的資料

for=

"item in itemlist"

:key=

"item.id"

>

<

/van-cell>

<

/van-list>

//沒資料時顯示

="no-data" v-if=

"!this.itemlist"

>

"../assets/images/null.png" alt=

"暫無記錄"

class

="img"

/>

<

/div>

<

/div>

<

/template>

export

default

,data()

;}, methods:

;//this.$api.pay.schedule(params)是我自己封裝的get請求介面

this

.$api.pay.

schedule

(params)

.then

(res =>

// 將新資料與老資料進行合併

this

.itemlist =

this

.itemlist.

concat

(rows)

;//如果列表資料條數》=總條數,不再觸發滾動載入if(

this

.itemlist.length >=

this

.total)})

;},//滾動載入時觸發,list元件定義的方法

onload()

}};<

/script>

元件 :immediate-check=「false」

理由:禁止 list 初始化時觸發 load 事件。把載入第一屏的事件放在 created() 裡面。

Vant 實現 上拉載入更多

vant 的list 元件 預設支援 瀑布流滾動載入。官方的示例是用定時器模擬的資料。我們在專案實戰中,肯定是結合ajax請求處理的。那麼我們該如何實現這個效果呢?vant 的 list元件 使用方法這裡就不詳細說明了,官方文件已經寫的很詳細了。直接上專案中的實戰 template div van ...

上拉載入更多

在ios開中中,由於螢幕尺寸限制,如果需要顯示的資料很多,需要用到分頁載入。資料來源是個array nsmutablearray items viewcontroller的這個方法返回資料條數 1是為了顯示 載入更多 的那個cell nsinteger tableview uitableview t...

iOS TableView實現上拉載入更多資料

1.建立重新整理控制項,並將控制項設定到tableview的tablefooterview void setupuprefresh 2.將更多資料載入到原資料的後面 self.datas addobject kmoredata 3.重新整理 並隱藏footerview 重新整理 self.table...