第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會有你想問的

急求!?。?!vue,better-scroll pulldown只能觸發(fā)一次,怎么解決?~

急求?。。?!vue,better-scroll pulldown只能觸發(fā)一次,怎么解決?~

繁華開滿天機(jī) 2019-09-26 10:58:23
{{showMsg}}importBScrollfrom'better-scroll'exportdefault{data(){return{showMsg:'下拉刷新...',show:false,}},props:{probeType:{type:Number,default:1},click:{type:Boolean,default:true},listenScroll:{type:Boolean,default:true},data:{type:Array|Object,default:null},pullup:{type:Boolean,default:true},pulldown:{type:Boolean,default:true},beforeScroll:{type:Boolean,default:false},refreshDelay:{type:Number,default:20},pullUpLoad:{type:Boolean,default:true},msg:{type:String,default:''},pullDownRefresh:{type:Boolean|Object,default:true}},mounted(){setTimeout(()=>{this._initScroll()},20)},computed:{msgCol(){switch(this.msg){case'black':return`color:#2f2725`default:return`color:#fff`}}},methods:{_initScroll(){if(!this.$refs.wrapper){return}this.scroll=newBScroll(this.$refs.wrapper,{probeType:this.probeType,click:this.click,pullDownRefresh:{threshold:50,stop:20},pullUpLoad:{threshold:-50}})if(this.listenScroll){letme=thisthis.scroll.on('scroll',pos=>{if(pos.y>50){this.show=truethis.showMsg='加載中...'}})}if(this.pullup){//上拉加載this.scroll.on('pullingUp',()=>{console.log(111)this.$emit('nextPage')this.scroll.finishPullUp()this.scroll.refresh()})}if(this.pulldown){//下拉刷新this.scroll.on('pullingDown',(pos)=>{this.$emit('pulldown')})}if(this.beforeScroll){this.scroll.on('beforeScrollStart',()=>{this.$emit('beforeScroll')})}},disable(){this.scroll&&this.scroll.disable()},enable(){this.scroll&&this.scroll.enable()},refresh(){this.scroll&&this.scroll.refresh()},scrollTo(){this.scroll&&this.scroll.scrollTo.apply(this.scroll,arguments)},scrollToElement(){this.scroll&&this.scroll.scrollToElement.apply(this.scroll,arguments)}},watch:{data(){setTimeout(()=>{this.refresh()},this.refreshDelay)}}}.bScroll-top{text-align:center;color:#ffffff;line-height:3rem;}已經(jīng)在pulldown后面加了this.scroll.finishPullUp(),this.scroll.refresh(),但是還是不能解決上拉加載就能加載一次的問題...請問各位,我這是哪里寫錯(cuò)了嗎~?或者寫漏了
查看完整描述

2 回答

?
拉莫斯之舞

TA貢獻(xiàn)1820條經(jīng)驗(yàn) 獲得超10個(gè)贊

組件應(yīng)該沒啥問題,使用的時(shí)候得增加一些判斷,防止重復(fù)請求。
data(){
return{
isLoaded:false//以此來判斷數(shù)據(jù)是否加載完了
}
},
methods:{
getNextPage(){
//只有isLoaded為false的時(shí)候才去加載數(shù)據(jù),這樣不就不會重復(fù)去請求接口了
if(!this.isLoaded){
this.isLoaded=true
//數(shù)據(jù)請求
axios.get('/api/xxx')
.then(res=>{
//請求成功了再將isLoaded變成false狀態(tài)
this.isLoaded=false
})
.error(err=>{
//error同理
this.isLoaded=false
})
}
}
}
                            
查看完整回答
反對 回復(fù) 2019-09-26
  • 2 回答
  • 0 關(guān)注
  • 1037 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號