Update app.js

This commit is contained in:
Anyon 2021-12-01 10:39:19 +08:00
parent 5a5242664f
commit 411d8fb3b3

View File

@ -13,9 +13,11 @@ console.log('baseRoot', appRoot)
getFile(url) { getFile(url) {
console.log('load.file', url) console.log('load.file', url)
if (!/^https?:\/\//.test(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 => { return fetch(url).then(res => {
if (res.ok) { if (res.ok) {
return {getContentData: binary => binary ? res.arrayBuffer() : res.text()}; return {getContentData: binary => binary ? res.arrayBuffer() : res.text()};
@ -47,7 +49,6 @@ console.log('baseRoot', appRoot)
// 路由前置处理 // 路由前置处理
let loading = null; let loading = null;
router.beforeEach(function (to, fr, next) { router.beforeEach(function (to, fr, next) {
console.log(to)
let name = to.fullPath.replace(/[.\/]+/g, '_'); let name = to.fullPath.replace(/[.\/]+/g, '_');
if (router.hasRoute(name)) { if (router.hasRoute(name)) {
console.log(''); console.log('');
@ -85,7 +86,7 @@ console.log('baseRoot', appRoot)
// }); // });
const app = Vue.createApp(Vue.defineAsyncComponent(function () { const app = Vue.createApp(Vue.defineAsyncComponent(function () {
return loadVue('./static/template/layout.vue'); return loadVue('/static/template/layout.vue');
})); }));
// 全局字体文件 // 全局字体文件