最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

结合mint-ui移动端下拉加载实践方法总结

来源:懂视网 责编:小采 时间:2020-11-27 22:25:45
文档

结合mint-ui移动端下拉加载实践方法总结

结合mint-ui移动端下拉加载实践方法总结:1.npm i mint-ui -S 2.main.js中引入import 'mint-ui/lib/style.css' 3.以下是代码结构部分: <template> <div class=main-body :style={'-webkit-overflow-scrolling': scrollMode}>
推荐度:
导读结合mint-ui移动端下拉加载实践方法总结:1.npm i mint-ui -S 2.main.js中引入import 'mint-ui/lib/style.css' 3.以下是代码结构部分: <template> <div class=main-body :style={'-webkit-overflow-scrolling': scrollMode}>

1.npm i mint-ui -S

2.main.js中引入import 'mint-ui/lib/style.css'

3.以下是代码结构部分:

<template>
 <div class="main-body" :style="{'-webkit-overflow-scrolling': scrollMode}">
 <v-loadmore :bottom-method="loadBottom" :bottom-all-loaded="allLoaded" :auto-fill="false" ref="loadmore">
 <ul class="list">

 <li v-for="(item, index) in proCopyright">
 <div>{{item.FZD_ZPMC}}</div>
 </li>

 </ul>

 </v-loadmore>

 </div>
</template>

<script>
 import {Loadmore} from 'mint-ui';
export default {
 components:{
 'v-loadmore':Loadmore,
 },
 data () {
 return {
 pageNo:1,
 pageSize:50,
 proCopyright:[],
 allLoaded: false, //是否可以上拉属性,false可以上拉,true为禁止上拉,就是不让往上划加载数据了
 scrollMode:"auto", //移动端弹性滚动效果,touch为弹性滚动,auto是非弹性滚动
 totalpage:0,
 loading:false,
 bottomText: '',
 }
 },
 mounted(){
 this.loadPageList(); //初次访问查询列表
 },
 methods:{
 loadBottom:function() {
 // 上拉加载
 this.more();// 上拉触发的分页查询
 this.$refs.loadmore.onBottomLoaded();// 固定方法,查询完要调用一次,用于重新定位
 },
 loadPageList:function (){
 // 查询数据
 this.axios.get('/copyright?key='+ encodeURIComponent('公司名称')+"&mask=001"+"&page="+this.pageNo+"&size="+this.pageSize).then(res =>{
 console.log(res);
 this.proCopyright = res.data.result.PRODUCTCOPYRIGHT;
 this.totalpage = Math.ceil(res.data.result.COUNTOFPRODUCTCOPYRIGHT/this.pageSize);
 if(this.totalpage == 1){
 this.allLoaded = true;
 }
 this.$nextTick(function () {
 // 是否还有下一页,加个方法判断,没有下一页要禁止上拉
 this.scrollMode = "touch";
 this.isHaveMore();
 });
 });
 },
 more:function (){
 // 分页查询
 if(this.totalpage == 1){
 this.pageNo = 1;
 this.allLoaded = true;
 }else{
 this.pageNo = parseInt(this.pageNo) + 1;
 this.allLoaded = false;
 }

 console.log(this.pageNo);
 this.axios.get('/copyright?key='+ encodeURIComponent('公司名称')+"&mask=001"+"&page="+this.pageNo+"&size="+this.pageSize).then(res=>{
 this.proCopyright = this.proCopyright.concat(res.data.result.PRODUCTCOPYRIGHT);
 console.log(this.proCopyright);
 this.isHaveMore();
 });
 },
 isHaveMore:function(){
 // 是否还有下一页,如果没有就禁止上拉刷新
 //this.allLoaded = false; //true是禁止上拉加载
 if(this.pageNo == this.totalpage){
 this.allLoaded = true;
 }
 }
 },
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
 li{
 padding:30px 0;
 background-color: #ccc;
 margin-bottom:20px;
 }
</style>

以上这篇结合mint-ui移动端下拉加载实践方法总结就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。

文档

结合mint-ui移动端下拉加载实践方法总结

结合mint-ui移动端下拉加载实践方法总结:1.npm i mint-ui -S 2.main.js中引入import 'mint-ui/lib/style.css' 3.以下是代码结构部分: <template> <div class=main-body :style={'-webkit-overflow-scrolling': scrollMode}>
推荐度:
标签: 总结 实践 mint-ui
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top