最近2018中文字幕在日韩欧美国产成人片_国产日韩精品一区二区在线_在线观看成年美女黄网色视频_国产精品一区三区五区_国产精彩刺激乱对白_看黄色黄大色黄片免费_人人超碰自拍cao_国产高清av在线_亚洲精品电影av_日韩美女尤物视频网站

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
怎么封裝了一個(gè)vue移動(dòng)端下拉加載下一頁(yè)數(shù)據(jù)的組件

小編給大家分享一下怎么封裝了一個(gè)vue移動(dòng)端下拉加載下一頁(yè)數(shù)據(jù)的組件,希望大家閱讀完這篇文章之后都有所收獲,下面讓我們一起去探討吧!

成都創(chuàng)新互聯(lián)公司是一家集網(wǎng)站建設(shè),新鄉(xiāng)縣企業(yè)網(wǎng)站建設(shè),新鄉(xiāng)縣品牌網(wǎng)站建設(shè),網(wǎng)站定制,新鄉(xiāng)縣網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷(xiāo),網(wǎng)絡(luò)優(yōu)化,新鄉(xiāng)縣網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力。可充分滿足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專(zhuān)業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。

組件代碼



import Load from '@/assets/Load.gif'
export default {
 name: 'myScroll',
 props: {
 'onPull': { // 加載回調(diào)
  type: Function,
  require: true
 },
 'scrollState': {// 是否可滑動(dòng)
  type: Boolean,
  require: true
 },
 loaded: {
  type: Boolean,
  default() {
  return false
  }
 }
 },
 data() {
 return {
  Load,
  timeoutId: null,
  state: 0,
  myScroll: null
 }
 },
 methods: {
 /*
    * 加載中:1
    * 加載完成:2
    * 沒(méi)有更多:3
    */
 setState(index) { // 修改狀態(tài)
  this.state = index
  // console.log(this.state)
 },
 onScroll(e) {
  const _this = this
  const scrollTop = document.documentElement.scrollTop || document.body.scrollTop
  // console.log(window.innerHeight + scrollTop, this.myScroll.offsetHeight)
  if (!this.loaded && window.innerHeight + scrollTop - 50 >= this.myScroll.offsetHeight) {
  clearTimeout(this.timeoutId)
  _this.timeoutId = setTimeout(() => {
   _this.bottomCallback()
  }, 100)
  }
 },
 bottomCallback() { // 加載回調(diào)
  // console.log('回調(diào)', new Date().getTime())
  if (this.state != 3) {
  this.state = 1
  this.onPull()
  }
 }
 },
 mounted() {
 this.myScroll = this.$refs.myScroll // 獲取滑條dom
 }
}


 .allow{
  overflow:hidden;
  height: auto;
 }
 .prohibit{
  max-width: 100%;
  max-height: 100%;
  height: 100%;
  overflow:hidden;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  will-change: transform;
  transition: all 450ms;
  backface-visibility: hidden;
  perspective: 1000;
 }
 .my-scroll{
  position: relative;
   color: #999;
  .scroll-top{
   text-align: center;
   display:flex;
   position:absolute;
   top:0;
   left:0;
    width:100%;
    overflow: hidden;
  }
  .scroll-list{
   overflow:hidden;
   min-height: 100%;
  }
  .scroll-bottom{
   text-align: center;
   line-height: .8rem;
  div{
    display:flex;
     height:auto;
    width:100%;
    justify-content: center;
    align-items:center;
    flex-wrap: wrap;
    i{
     flex:1 0 100%;
     display:block;
     height: 0.4rem;
    }
    img{
     width:0.6rem;
    }
    p{
     flex:1 0 100%;
    }
   }
  }
 }

使用





#app {
 font-family: "Avenir", Helvetica, Arial, sans-serif;
 -webkit-font-smoothing: antialiased;
 -moz-osx-font-smoothing: grayscale;
 text-align: center;
 color: #2c3e50;
 margin-top: 60px;
}
.scrolls{
 font-size:.24rem;
}
.list{
 height:.9rem;
 line-height: .9rem;
 margin-bottom:.1rem;
 border-bottom:1px solid #dedede;
 color:#999;
 font-size:.28rem;
}

看完了這篇文章,相信你對(duì)“怎么封裝了一個(gè)vue移動(dòng)端下拉加載下一頁(yè)數(shù)據(jù)的組件”有了一定的了解,如果想了解更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!


網(wǎng)頁(yè)題目:怎么封裝了一個(gè)vue移動(dòng)端下拉加載下一頁(yè)數(shù)據(jù)的組件
標(biāo)題網(wǎng)址:http://fisionsoft.com.cn/article/gedoec.html