Doc: optimzie mobile demo

This commit is contained in:
陈嘉涵
2017-09-05 10:17:49 +08:00
parent 5e84e2e9cb
commit 99f712104e
7 changed files with 21 additions and 26 deletions
+9 -5
View File
@@ -18,8 +18,7 @@ window.syncPath = function(dir) {
};
window.changePath = function(path) {
const router = window.vueRouter;
router.replace(path);
window.vueRouter.replace(path);
};
function iframeReady(iframe, callback) {
@@ -27,10 +26,15 @@ function iframeReady(iframe, callback) {
if (doc.readyState === 'complete') {
callback();
} else {
iframe.onload = () => {
setTimeout(() => {
const interval = () => {
if (iframe.contentWindow.changePath) {
callback();
}, 50);
} else {
setTimeout(() => {
interval();
}, 50);
}
};
iframe.onload = interval;
}
}