主题 : 手机端列表页“加载更多”不能用
级别: 举人
UID: 128268
积分:169 加为好友
威望: 15 精华: 0
主题:23 回复:84
注册时间:2019-02-23
在线时长:0
1#   发表于:2020-08-24 17:00:32  IP:121.112.*.*
js代码是如下,只把new vue 里的标签id 跟我实际模板的标签id改成一致的了。其他没动。为啥没有滚动 “加载更多”的效果啊。问题出在哪里啊啊啊啊啊啊啊

//获取要定位元素距离浏览器顶部的距离
var navH = $(".channel").offset().top;
// console.log(navH);
//滚动条事件
$(window).scroll(function() {
//获取滚动条的滑动距离
var scroH = $(this).scrollTop();
// console.log(scroH);
//滚动条的滑动距离大于等于定位元素距离浏览器顶部的距离,就固定,反之就不固定
if (scroH >= navH) {
$(".channel").css({
"position": "sticky",
"top": '0.96rem',
"z-index": 10
});

}else if (scroH < navH) {
$(".channel").css({
"position": "static"
});
}
})
var mySwiper = new Swiper('.swiper-container', {
autoplay: {
delay: 1000, //4.0自动切换滚动 间隔时间1秒   单位是毫秒
disableOnInteraction: false //4.0用户操作swiper后是否禁止autoplay,默认为t rue静止。
},
speed: 1000, //定义切换的速度
loop: true, //定义循环播放 true  (false 为默认值 不循环)
pagination: { //4.0的分页器
el: ".swiper-pagination"
}
})
var news = new Vue({
el: '#news',
data: {
load: '加载更多',
uploading: true,
getData: {
channelPaths: '${channel.path}',
orderBy: 1,
channelOption:1,
page: 1,
size: 10
},
isload: false,
list: [],
newPage: [],
last: false,
navList: [],
path: '${channel.path}',
listLength: '${listLength}'
},
mounted() {
if (this.listLength < 10) {
this.load = '没有更多了'
this.isload = false
this.last = true
}
},
created() {
var that = this
api.GET('/channel/list', {
parentId: 1747
}, function(res) {
console.log(res)
if (res.code == 200) {
that.navList = res.data
}

})
},
methods: {
loading() {
if (this.uploading) {
this.uploading = false
if (!this.last) {
this.load = '加载更多'
this.isload = true
this.getData.page += 1
this.getContentPage()
} else {
this.load = '没有更多了'
this.isload = false
}
}
},
getContentPage() {
var that = this
api.GET('/content/page', that.getData, function(res) {
console.log(res)
if (res.code == 200) {
that.last = res.data.last
if (!that.last) {
that.load = '加载更多'
that.isload = true
} else {
that.load = '没有更多了'
that.isload = false
}
that.newPage = res.data.content;
that.list = that.list.concat(that.newPage)
that.uploading = true
}

})
}
}
})
级别: 论坛管理员
UID: 122721
积分:57884 加为好友
威望: 2 精华: 1
主题:5 回复:50085
注册时间:2018-05-07
在线时长:0
2#   发表于:2020-08-24 17:09:27  IP:59.48.*.*
您做了二开?
每天告诉自己一次,“我真的很不错”。
级别: 举人
UID: 128268
积分:169 加为好友
威望: 15 精华: 0
主题:23 回复:84
注册时间:2019-02-23
在线时长:0
3#   发表于:2020-08-24 17:17:44  IP:121.112.*.*
回复第2楼
没有二开。就是改之前的模板。
级别: 论坛管理员
UID: 122721
积分:57884 加为好友
威望: 2 精华: 1
主题:5 回复:50085
注册时间:2018-05-07
在线时长:0
4#   发表于:2020-08-24 17:25:03  IP:59.48.*.*
您上面写的这些不是模板内容吧  是js文件啊
每天告诉自己一次,“我真的很不错”。
级别: 举人
UID: 128268
积分:169 加为好友
威望: 15 精华: 0
主题:23 回复:84
注册时间:2019-02-23
在线时长:0
5#   发表于:2020-08-24 17:28:10  IP:121.112.*.*
回复第4楼
是模板内的js文件
级别: 举人
UID: 128268
积分:169 加为好友
威望: 15 精华: 0
主题:23 回复:84
注册时间:2019-02-23
在线时长:0
6#   发表于:2020-08-24 17:29:50  IP:121.112.*.*
回复第4楼
原 mobile\channel\news.html 里面的js文件
1 共1页