修复 demo 浏览历史记录错乱的问题 location.hash

This commit is contained in:
陈锋
2016-02-17 11:56:55 +08:00
committed by progrape
parent 5dda763cfb
commit 7bbd1eef5f
2 changed files with 2 additions and 18 deletions

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}