Comments (12)
下拉列表在后退的时候无法定位之前下拉位置,在苹果浏览器后退不会执行JS,但是在其他chrome后退会执行JS。导致位置重置。这个问题目前用startY来决绝。MUI是否能解决这个问题
from mui.
没明白是什么意思
from mui.
例子:我类表有11个项,我下拉到最后一个位置。点击项目详情,看完后返回。这个时候列表又回到列表头部,没有保留跳转前的位置。
from mui.
这个影响用户体验。
from mui.
你是说点击后退之后?
如果是在5+环境,可以使用预加载机制,预加载该下拉刷新窗口,这样的话,后退不会关闭下拉刷新窗口,而是隐藏。再打开,是直接显示,这样就可以保证下拉所处的位置不变。
可以测试我们的hello-mui里的下拉刷新,后退再进去,位置是不变的
from mui.
好吧。我用的是WAP项目。呵呵openwinods体验不好。了解了谢谢了!
from mui.
浏览器环境的话,需要你自己实现。比如cookie记录当前位置。下次进入后,自动滚动到当前位置
from mui.
目前是在2126行的//API setTranslate方法保存Y值。框架没设置回调方法,只能修改MUI的JS来实现
然后初始化的时候传入startY
from mui.
不需要改源码,监听scrollend事件。e.detail是当前的scroll对象。直接获取y值即可
document.getElementById("scroll").addEventListener('scrollend', function(e) {
console.log(e.detail.y);
});
from mui.
太感谢了。之前就是尝试各种方法都监听不到Y值。无奈就改源码。测试OK了才过来发问题。
from mui.
因为scrollend可能触发非常频繁,所以建议不要在scrollend里边添加比较复杂的代码,比如直接操作cookie。而是把e.detail.y值赋给一个全局y值。然后通过定时事件检查y值是否变化,然后设置cookie。
示例代码
var y = 0;
var lastY = 0;
window.setInterval(function() {
if (y != lastY) {
//TODO 将y存储到cookie
lastY = y;
}
}, 100);
document.getElementById("scroll").addEventListener('scrollend', function(e) {
y = e.detail.y;
});
from mui.
我是存到window.history.replaceState,来实现多个拉下页面切换后多次返回结果的存储。谢谢大神解惑!
from mui.
Related Issues (20)
- 请问旧版本在哪里下载?没有找到链接
- 1.9.0 没有打tag
- 同一个button,在不同title时设置loading,然后reset,title始终被重置为第一次loading前的。
- mui.back()在vivo手机上,不执行返回上一页
- H5中的mui 的picker在webview中的问题
- mui 省市区 东莞市下 没有数据
- 这个项目还在维护吗 HOT 4
- mui.ajax ios13版本请求偶发性报错abort HOT 2
- 省市区数据缺失,济源市找不到 HOT 1
- mui语音播报报 eak错误 HOT 1
- picker(选择器)支持搜索框?
- 有没有好心人给个官方TabBar的example
- 这个库已经停更了吗? HOT 3
- 关于框架会自动后台搜寻手机信息
- iOS16.2版本中所有的选择器都有错位现象 HOT 11
- iOS16.3版本中所有的选择器都有错位现象 HOT 3
- MUI ios16.4 选择器滑动的数据出现白条 日期选择也出现错位白条 HOT 3
- .mui-picker-inner {
- mui.DtPicker 在ios16.3下不能选择日期,但是在安卓下可以 HOT 3
- 关于微信客户端内置浏览器使用MUI的picker组件出现遮挡的问题 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mui.