mirror of
https://github.com/Tencent/weui.git
synced 2026-03-13 08:02:03 +08:00
修复 demo 浏览历史记录错乱的问题 location.hash
This commit is contained in:
10
dist/example/example.js
vendored
10
dist/example/example.js
vendored
@@ -9,7 +9,6 @@ $(function () {
|
||||
_pageStack: [],
|
||||
_configs: [],
|
||||
_defaultPage: null,
|
||||
_isGo: false,
|
||||
default: function (defaultPage) {
|
||||
this._defaultPage = defaultPage;
|
||||
return this;
|
||||
@@ -19,12 +18,6 @@ $(function () {
|
||||
|
||||
$(window).on('hashchange', function (e) {
|
||||
|
||||
var _isBack = !self._isGo;
|
||||
self._isGo = false;
|
||||
if (!_isBack) {
|
||||
return;
|
||||
}
|
||||
|
||||
var url = location.hash.indexOf('#') === 0 ? location.hash : '#';
|
||||
var found = null;
|
||||
for(var i = 0, len = self._pageStack.length; i < len; i++){
|
||||
@@ -70,7 +63,6 @@ $(function () {
|
||||
dom: $html
|
||||
});
|
||||
|
||||
this._isGo = true;
|
||||
location.hash = config.url;
|
||||
|
||||
if (!config.isBind) {
|
||||
@@ -122,7 +114,7 @@ $(function () {
|
||||
'.js_grid': {
|
||||
click: function (e) {
|
||||
var id = $(this).data('id');
|
||||
pageManager.go(id);
|
||||
location.hash = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ $(function () {
|
||||
_pageStack: [],
|
||||
_configs: [],
|
||||
_defaultPage: null,
|
||||
_isGo: false,
|
||||
default: function (defaultPage) {
|
||||
this._defaultPage = defaultPage;
|
||||
return this;
|
||||
@@ -19,12 +18,6 @@ $(function () {
|
||||
|
||||
$(window).on('hashchange', function (e) {
|
||||
|
||||
var _isBack = !self._isGo;
|
||||
self._isGo = false;
|
||||
if (!_isBack) {
|
||||
return;
|
||||
}
|
||||
|
||||
var url = location.hash.indexOf('#') === 0 ? location.hash : '#';
|
||||
var found = null;
|
||||
for(var i = 0, len = self._pageStack.length; i < len; i++){
|
||||
@@ -70,7 +63,6 @@ $(function () {
|
||||
dom: $html
|
||||
});
|
||||
|
||||
this._isGo = true;
|
||||
location.hash = config.url;
|
||||
|
||||
if (!config.isBind) {
|
||||
@@ -122,7 +114,7 @@ $(function () {
|
||||
'.js_grid': {
|
||||
click: function (e) {
|
||||
var id = $(this).data('id');
|
||||
pageManager.go(id);
|
||||
location.hash = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user