
uni-app使用小程序自定義組件 uni-app背景如何覆蓋導航欄?很多人不了解,今天各百科為大家?guī)硐嚓P內(nèi)容,下面一起來看看吧。
在uni-app中配置pages.json,可以通過滑動頁面到底部來監(jiān)聽onReachBottom()方法,配置如下:
//pages.json文件{'path' :' pages/index ',' style' 3360 { '導航欄標題文本' 3360 '當前頁面標題','導航樣式' 3360 '自定義',//當前頁面不需要導航' enableplldownrefresh ' 3360 true。//配置完成后,可以下拉刷新,上拉加載' onReachBottomdistance ' 3360100 } },//滑動到頁面底部時,會觸發(fā)(上拉加載)onReachBottom() {console.log('滑動到。業(yè)務’);},//Trigger(下拉刷新)onPullDownRefresh () {//放置執(zhí)行下拉時要執(zhí)行的動作.wx.stopPullDownRefresh() //停止下拉刷新效果的api。如果進入刷新狀態(tài)發(fā)現(xiàn)停不下來,可以用這個}。獲取數(shù)據(jù)思路:頁面加載時,你會先請求10條數(shù)據(jù),然后用戶滑動。
Data() {//return {hots://主動數(shù)據(jù)表params: {limit 3360 10,//默認請求為10 start3360 0,},//是否有下一頁,即是否有數(shù)據(jù)hasMore: true,DataEnd:false,//數(shù)據(jù)已加載}},//onloadonload 3360 function(option){ this . getlist()頁面生命周期方法;//頁面加載獲取前10條數(shù)據(jù)},//頁面滑動到底部時觸發(fā)的方法的onReachBottomonReachBottomm(){ this . handletolower();//滑動到底部加載}、//方法并放入方法methods:{ //獲取接口數(shù)據(jù)——因為會重復執(zhí)行,所以封裝在這里getlist(){ uni . show loading({ Title 3360 ' loading '//為了網(wǎng)速慢,等待用戶友好的提示});//使接口數(shù)據(jù)請求uni。請求({url:getapp()。globaldata.url' list ',//address method3360' post ',//mode data3360this.params,//參數(shù)success 3360(result)={ if(result . data . data)this . dataend=true return;}//數(shù)據(jù)拼接this.hots=.這個. hots,result.data.data},complete(){ uni . hide loading();//加載彈出窗口end}}},//getlist()方法end //托底請求的方法是修改參數(shù)handleTolower() {//1,修改參數(shù)skip=limit 2,重發(fā)請求3,疊加數(shù)據(jù)if(this . has more){ this . params . start=this . params . this . getlist();} else {//彈出窗口或其他形式告訴用戶沒有數(shù)據(jù)this . dataend=true } }//handle to lower()end }















