jqueryMobile内联页面(Internal Page)强制刷新的代码如下:
$.mobile.changePage(pageurl, {
'allowSamePageTransition' : true,
'reloadPage' : true,
'transition' : 'none'
});
代码解读:
- pageurl: 指向当前页面的页面id或者路径
- allowSamePageTransition:默认情况下,changPage函数会自动忽略与当前页面相同的页面更改请求。将此标志设置为true,使其不能忽略页面更改请求。
- reloadPage:设置为true时,可令页面Dom重新装载,可触发一系列构造过程。
- transition:因为打开 allowSamePageTransition 时,会带来 transition 动画的问题(某些 transition 是假设新旧页面是不同),所以将transition设置为none避开这个问题。
本文介绍了使用jQuery Mobile实现内联页面(InternalPage)强制刷新的方法。通过设置参数allowSamePageTransition为true来允许相同页面的过渡,并设置reloadPage为true以重新加载页面DOM,解决页面不更新的问题。
437

被折叠的 条评论
为什么被折叠?



