feat(cli): support custom simulator (#8499)

This commit is contained in:
neverland
2021-04-10 17:01:09 +08:00
committed by GitHub
parent 3ddfe3bbb4
commit 16ff1ba9a7
6 changed files with 35 additions and 10 deletions

View File

@@ -2,6 +2,8 @@
* 同步父窗口和 iframe 的 vue-router 状态
*/
import { config } from 'site-desktop-shared';
let queue = [];
let isIframeReady = false;
@@ -27,7 +29,12 @@ if (window.top === window) {
function getCurrentDir() {
const router = window.vueRouter;
return router.currentRoute.value.path;
const { path } = router.currentRoute.value;
if (config.site.simulator?.routeMapper) {
return config.site.simulator?.routeMapper(path);
}
return path;
}
export function syncPathToParent() {