From 411d8fb3b3bd03fa79b50a1165751d30ff470cb0 Mon Sep 17 00:00:00 2001 From: Anyon Date: Wed, 1 Dec 2021 10:39:19 +0800 Subject: [PATCH] Update app.js --- static/app.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/static/app.js b/static/app.js index 9acbad59a..0602bd3ea 100644 --- a/static/app.js +++ b/static/app.js @@ -13,9 +13,11 @@ console.log('baseRoot', appRoot) getFile(url) { console.log('load.file', url) if (!/^https?:\/\//.test(url)) { - url += url; + url = appRoot + url; } - url = url.replace(/\/.\//g, '/'); + url = url.replace(/\/+.\/+/g, '/'); + console.log(url) + return fetch(url).then(res => { if (res.ok) { return {getContentData: binary => binary ? res.arrayBuffer() : res.text()}; @@ -47,7 +49,6 @@ console.log('baseRoot', appRoot) // 路由前置处理 let loading = null; router.beforeEach(function (to, fr, next) { - console.log(to) let name = to.fullPath.replace(/[.\/]+/g, '_'); if (router.hasRoute(name)) { console.log(''); @@ -85,7 +86,7 @@ console.log('baseRoot', appRoot) // }); const app = Vue.createApp(Vue.defineAsyncComponent(function () { - return loadVue('./static/template/layout.vue'); + return loadVue('/static/template/layout.vue'); })); // 全局字体文件