目前就是刷新局部视图,jquery-mobile的某些样式会失效,需要强制刷新整个页面。
如何刷新整个页面?
补充:如果使用location.replace()
,先是location.replace('page/page1.html)
这样直接定位到具体位置,这样的话只会那个页面的代码,实际上那个页面是一个模板页面,那么那个模板页面就是纯HTML,无CSS部分。
然后用location.replace(#page1)
这样只是切换了局部视图,并没有什么效果。
如果是$location.reload()
那么会跳转到路由里/
定义的位置,不是刷新当前页面………………
如何刷新当前整个页面?或者
如果当前页面是http://localhost:8080/#/setting
F5后是http://localhost:8080/setting#/
那么路由到otherwise,也就是/
PHPz2017-05-15 16:55:12
You need to force refresh the entire page. Partial refresh is not possible
It’s the effect of F5
=====================>
Found after refreshing url会变化
If the url does not change, then we can use window.reload
So we need to solve the problem of URL changes
=====================>
Because the page keeps reporting error loading page error
I checked and this is from jquery-mobile
Then I blocked the JS and CSS files of JQM and found URL变化是JQM引起的
Find related solutions
=====================>
Oh, if you want to persistjquery-mobile+angular
You need to use jqm's page jump.
=====================>
Front-end UI framework by jquery-mobile
替换为bootstrap
jqm和angular关于前端路由方面有冲突
,
If you insist on using jqm, you cannot use angular's front-end routing. You must use jqm's jq to write page jumps, which may cause the page to be messy.
So it took half a day to replace it with bootstrap.
PHP中文网2017-05-15 16:55:12
I don’t know why, but I really want to help you when I see your situation. Currently I am also integrating JQM and Angularjs and have some ideas!
Specifically, configure some parameters when initializing jqm:
$( document ).on( "mobileinit", function() {
$.mobile.page.prototype.options.domCache = false;// 关闭缓存
$.mobile.initializePage = false;
$.mobile.defaultPageTransition = "fade";
$.mobile.autoInitializePage = true;
$.mobile.hideUrlBar = false;
$.mobile.linkBindingEnabled = false;
$.mobile.hashListeningEnabled = false;
$.mobile.ajaxEnabled = false;
});
Please refer to the official API documentation for each configuration.
One of these configurations is to solve the URL conflict problem, which is to turn off JQM routing.