先上图:

滑动页面中的列表最下面会出现这个undefine,不知道怎么配置
我自己配置的
pulldownConfig: {
content: '下拉刷新 ↓',
downContent: '下拉刷新 ↓',
upContent: '松开 ↑',
loadingContent: '正在加载...'
},
pullupConfig: {
content: '',
downContent: '',
upContent: '',
loadingContent: '正在加载...',
clsPrefix: 'xs-plugin-pullup-'
},
使用的部分:
<scroller height="-44" lock-x use-pulldown use-pullup :pulldown-config="pulldownConfig"
:pullup-config="pullupConfig" ref="my_scroller"
@on-pullup-loading="onLoadItem" @on-pulldown-loading="onRefresh">
<ul>
<li></li>
</ul>
</scroller>
补充下版本。
版本:2.2.1-rc.5
我实在是不知道哪里写错了,水平还达不到看源码,只能每次在reset之后用这个方法。
function fixScroller() {
let oUndefined = document.getElementsByClassName('xs-plugin-pullup-undefined');
oUndefined[0].innerHTML = '没有更多了';
};
另外我想问问,有没有设置全局Scroller的方法?我就想设置一次就可以把那些上拉下拉的提示换成中文,麻烦告知一下,如果有我就自己找,也不麻烦您再介绍了。
@airyland
你的 script 代码也帖下吧。没有全局配置,你可以引用同一个 pullup config。
onLoadItem() {
let getData = '';
axios.get()
.then((response) => {
if (response.status === 200) {
response = response.data;
// 判断是否加载到最后一页
if (response.list.length === 0) {
this.$refs.my_scroller.disablePullup();
} else {
this.$refs.my_scroller.enablePullup();
}
// 更新视图
this.$refs.my_scroller.donePulldown();
this.refreshScroller();
} else {
console.error('数据请求失败');
}
});
},
refreshScroller(isResetTop) {
// 等待页面渲染,刷新,每次更新视图都要调用
// https://vux.li/#/zh-CN/components?id=scroller
let obj = isResetTop ? {top: 0} : {};
this.$nextTick(() => {
this.$refs.my_scroller.reset(obj);
fixScrollerBug();
});
},
onRefresh() {
this.onLoadItem();
},
您看看,我把业务代码都删了
我觉得reset方法可以从组件内部改造成:每n毫秒判断高端变化,无变化则结束,使用loaded高度,不用每次使用的时候都要去做reset。
如果没有这样做,外部使用的时候,图片容器高度要预设值,这样计算高度就会忽略图片加载时间;就目前来看settimeout 2000毫秒或多少毫秒这种做法,感觉不够顺畅。
因 scroller 组件已经不再维护 该 issue 关闭了。
@wh-Coder
调用enablePullup方法后,会调用内部的pullup组件的restart方法(pullup的restart方法),这回导致内部的status变成default,你需要设置pullupConfig的defaultContent
调用this.$refs.my_scroller.donePullup()就行了
而且必须在enablePullup()或者disablePullup()之后
Most helpful comment
@wh-Coder
调用enablePullup方法后,会调用内部的pullup组件的restart方法(pullup的restart方法),这回导致内部的status变成default,你需要设置pullupConfig的defaultContent