JQueryMobile 1.4自动增强我的锚链接并通过AJAX获取其内容。在某些情况下,如果链接指向用户当前所在的同一页面,我希望这些锚链接能够重新加载。如果我控制对changePage的调用,那么我可以指定reloadPage = true,但是JQueryMobile似乎没有为增强的锚点公开这个选项。我在pagecontainer的加载函数中将这个逻辑跟踪到这些行:
_loadDefaults: {
[...]
// DEPRECATED
reloadPage: false,
reload: false,
[...]
settings = $.extend( {}, this._loadDefaults, options ),
[...]
settings.reload = settings.reloadPage;
[...]
// If the content we are interested in is already in the DOM,
// and the caller did not indicate that we should force a
// reload of the file, we are done. Resolve the deferrred so that
// users can bind to .done on the promise
if ( content.length && !settings.reload ) {
https://github.com/jquery/jquery-mobile/blob/master/js/widgets/pagecontainer.js
如何更改_loadDefaults?该对象不在$ .mobile.pageContainer.pagecontainer下面。
如果我在JQM源中手动将reloadPage更新为true,则此方法有效。我只是在寻找如何在不修改JQM源的情况下做同样的事情。谢谢!