优化后退前进问题

This commit is contained in:
java110 2020-03-13 00:32:27 +08:00
parent a8dd6f16c3
commit 9580335b28

View File

@ -350,10 +350,10 @@
if (!vcFramework.isNotNull(_cacheComponent)) { if (!vcFramework.isNotNull(_cacheComponent)) {
let _domain = 'components'; let _domain = 'components';
if(_tree.vcCreate.hasAttribute("domain")){ if (_tree.vcCreate.hasAttribute("domain")) {
_domain = _tree.vcCreate.getAttribute("domain"); _domain = _tree.vcCreate.getAttribute("domain");
} }
var filePath = '/'+_domain+'/' + _componentName + '/' + _componentName; var filePath = '/' + _domain + '/' + _componentName + '/' + _componentName;
var htmlFilePath = filePath + ".html"; var htmlFilePath = filePath + ".html";
var jsFilePath = filePath + ".js"; var jsFilePath = filePath + ".js";
//加载html 页面 //加载html 页面
@ -900,11 +900,11 @@
return; return;
} }
//刷新框架参数 //刷新框架参数
refreshVcFramework(); //refreshVcFramework();
//修改锚点 //修改锚点
location.hash = url.substring(url.indexOf("#") + 1, url.length); location.hash = url.substring(url.indexOf("#") + 1, url.length);
vcFramework.reBuilderVcTree(); //vcFramework.reBuilderVcTree();
}; };
refreshVcFramework = function () { refreshVcFramework = function () {
@ -1346,6 +1346,21 @@
}); });
} }
})(window.vcFramework); })(window.vcFramework);
/**
* 锚点变化监听
*/
(function (vcFramework) {
window.addEventListener("hashchange", function (e) {
let _componentUrl = location.hash;
//判断是否为组件页面
if (!vcFramework.notNull(_componentUrl)) {
return;
}
refreshVcFramework();
vcFramework.reBuilderVcTree();
}, false);
})(window.vcFramework);