mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-05 19:41:44 +08:00
Update app.js
This commit is contained in:
parent
411d8fb3b3
commit
12d7e68036
@ -1,23 +1,19 @@
|
||||
/*! 脚本应用根路径 */
|
||||
window.appRoot = (function (src) {
|
||||
return src.pop(), src.pop(), src.join('/') + '/';
|
||||
})(document.scripts[document.scripts.length - 1].src.split('/'));
|
||||
|
||||
console.log('baseRoot', appRoot)
|
||||
/*! 项目应用根路径 */
|
||||
window.appRoot = (function (script) {
|
||||
let src = script.src.split('/').slice(3);
|
||||
return src.pop(), src.pop(), '/' + src.join('/') + '/';
|
||||
})(document.querySelector('script[src][type=module]:last-child'));
|
||||
|
||||
;(async () => {
|
||||
const options = {
|
||||
moduleCache: {
|
||||
vue: Vue, less: less
|
||||
vue: Vue,
|
||||
less: less
|
||||
},
|
||||
getFile(url) {
|
||||
console.log('load.file', url)
|
||||
if (!/^https?:\/\//.test(url)) {
|
||||
url = appRoot + url;
|
||||
if (!/^(https?:)?\/\//.test(url)) {
|
||||
url = (appRoot + 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()};
|
||||
|
Loading…
x
Reference in New Issue
Block a user