大改动

This commit is contained in:
Aicirou 2020-05-06 20:45:18 +08:00
parent 8747ca0d16
commit 0513d69838
27 changed files with 287 additions and 368 deletions

86
buildAppJSPlugin.js Normal file
View File

@ -0,0 +1,86 @@
const cdnDependencies = require("./dependencies-cdn");
// 引入文件的 cdn 链接
const cdn = {
css: cdnDependencies.map((e) => e.css).filter((e) => e),
js: cdnDependencies.map((e) => e.js).filter((e) => e),
};
class BuildAppJSPlugin {
apply(compiler) {
// emit 是异步 hook使用 tapAsync 触及它,还可以使用 tapPromise/tap(同步)
compiler.hooks.emit.tapAsync(
"BuildAppJSPlugin",
(compilation, callback) => {
let cssarr = [];
let jsarr = [];
// 遍历所有编译过的资源文件,
// 对于每个文件名称,都添加一行内容。
for (let filename in compilation.assets) {
if (process.env.NODE_ENV === "production") {
filename = (process.env.VUE_APP_PUBLIC_PATH || "/") + filename;
} else {
filename = "/" + filename;
}
// filename = "/" + filename;
if (filename.match(".*\\.js$")) {
jsarr.push(filename);
}
if (filename.match(".*\\.css$")) {
cssarr.push(filename);
}
}
cssarr = cssarr.sort(function(a) {
return a.indexOf("app.");
});
var cdnjs = ''
if (process.env.NODE_ENV === "production") {
cssarr = cdn.css.concat(cssarr);
cdnjs = `var cdnjs = ${JSON.stringify(cdn.js)};
cdnjs.forEach((item) => {
document.write('<script src="' + item + '"></script>');
});`
} else {
cssarr = cssarr.concat(cdnDependencies
.filter((e) => e.name === "")
.map((e) => e.css));
}
let content = `
var styles = ${JSON.stringify(cssarr)};
var scripts = ${JSON.stringify(jsarr)};
${cdnjs}
document.write('<div id="app"></div>');
var title = document.getElementsByTagName('title')
styles.forEach((item) => {
let link = document.createElement('link');
link.href=item;
link.rel = 'preload';
link.as = 'style';
title[0].parentNode.insertBefore(link,title[0])
link = document.createElement('link');
link.href=item;
link.rel = 'stylesheet';
title[0].parentNode.insertBefore(link,title[0])
});
scripts.forEach((item) => {
document.write('<script src="' + item + '"></script>');
});
`;
// 将这个列表作为一个新的文件资源,插入到 webpack 构建中:
compilation.assets["app.js"] = {
source: function() {
return content;
},
size: function() {
return cssarr.length + jsarr.length;
},
};
callback();
}
);
}
}
module.exports = BuildAppJSPlugin;

View File

@ -3,6 +3,8 @@ module.exports = [
{ name: 'vue-i18n', library: 'VueI18n', js: 'https://cdn.jsdelivr.net/npm/vue-i18n@8.17.3/dist/vue-i18n.min.js', css: '' }, { name: 'vue-i18n', library: 'VueI18n', js: 'https://cdn.jsdelivr.net/npm/vue-i18n@8.17.3/dist/vue-i18n.min.js', css: '' },
{ name: 'vue-router', library: 'VueRouter', js: 'https://cdn.jsdelivr.net/npm/vue-router@3.1.6/dist/vue-router.min.js', css: '' }, { name: 'vue-router', library: 'VueRouter', js: 'https://cdn.jsdelivr.net/npm/vue-router@3.1.6/dist/vue-router.min.js', css: '' },
{ name: 'axios', library: 'axios', js: 'https://cdn.jsdelivr.net/npm/axios@0.19.2/dist/axios.min.js', css: '' }, { name: 'axios', library: 'axios', js: 'https://cdn.jsdelivr.net/npm/axios@0.19.2/dist/axios.min.js', css: '' },
// { name: 'element-ui', library: 'ELEMENT', js: 'https://cdn.jsdelivr.net/npm/element-ui@2.13.1/lib/index.js', css: 'https://cdn.jsdelivr.net/npm/element-ui@2.13.1/lib/theme-chalk/index.css' },
{ name: 'js-cookie', library: 'Cookies', js: 'https://cdn.jsdelivr.net/npm/js-cookie@2.2.1/src/js.cookie.min.js', css: '' },
// { name: 'brace', library: 'ace', js: 'https://cdn.jsdelivr.net/npm/brace@0.11.1/index.min.js', css: '' }, // { name: 'brace', library: 'ace', js: 'https://cdn.jsdelivr.net/npm/brace@0.11.1/index.min.js', css: '' },
// { name: 'brace/ext/language_tools', library: 'language_tools', js: ' https://cdn.jsdelivr.net/npm/brace@0.11.1/ext/language_tools.js', css: '' }, // { name: 'brace/ext/language_tools', library: 'language_tools', js: ' https://cdn.jsdelivr.net/npm/brace@0.11.1/ext/language_tools.js', css: '' },
// { name: 'brace/mode/html', library: 'html', js: ' https://cdn.jsdelivr.net/npm/brace@0.11.1/mode/html.js', css: '' }, // { name: 'brace/mode/html', library: 'html', js: ' https://cdn.jsdelivr.net/npm/brace@0.11.1/mode/html.js', css: '' },
@ -15,4 +17,5 @@ module.exports = [
{ name: '', library: '', js: '', css: 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css' }, { name: '', library: '', js: '', css: 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css' },
{ name: '', library: '', js: '', css: 'https://cdn.jsdelivr.net/npm/font-awesome@latest/css/font-awesome.min.css' }, { name: '', library: '', js: '', css: 'https://cdn.jsdelivr.net/npm/font-awesome@latest/css/font-awesome.min.css' },
{ name: '', library: '', js: '', css: 'https://cdn.jsdelivr.net/npm/font-awesome-animation@0.2.1/dist/font-awesome-animation.min.css' }, { name: '', library: '', js: '', css: 'https://cdn.jsdelivr.net/npm/font-awesome-animation@0.2.1/dist/font-awesome-animation.min.css' },
{ name: '', library: '', js: '', css: 'https://cdn.jsdelivr.net/npm/bulma-pageloader@0.3.0/dist/css/bulma-pageloader.min.css' },
] ]

135
package-lock.json generated
View File

@ -2143,14 +2143,6 @@
"integrity": "sha1-3TeelPDbgxCwgpH51kwyCXZmF/0=", "integrity": "sha1-3TeelPDbgxCwgpH51kwyCXZmF/0=",
"dev": true "dev": true
}, },
"async-validator": {
"version": "1.8.5",
"resolved": "https://registry.npm.taobao.org/async-validator/download/async-validator-1.8.5.tgz",
"integrity": "sha1-3D4I7B/Q3dtn5ghC8CwM0c7G1/A=",
"requires": {
"babel-runtime": "6.x"
}
},
"asynckit": { "asynckit": {
"version": "0.4.0", "version": "0.4.0",
"resolved": "http://registry.npm.taobao.org/asynckit/download/asynckit-0.4.0.tgz", "resolved": "http://registry.npm.taobao.org/asynckit/download/asynckit-0.4.0.tgz",
@ -2232,11 +2224,6 @@
"resolve": "^1.12.0" "resolve": "^1.12.0"
} }
}, },
"babel-helper-vue-jsx-merge-props": {
"version": "2.0.3",
"resolved": "https://registry.npm.taobao.org/babel-helper-vue-jsx-merge-props/download/babel-helper-vue-jsx-merge-props-2.0.3.tgz",
"integrity": "sha1-Iq69OzOQIyjlEyk6jkmSs4T58bY="
},
"babel-loader": { "babel-loader": {
"version": "8.1.0", "version": "8.1.0",
"resolved": "https://registry.npm.taobao.org/babel-loader/download/babel-loader-8.1.0.tgz?cache=0&sync_timestamp=1584717315701&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbabel-loader%2Fdownload%2Fbabel-loader-8.1.0.tgz", "resolved": "https://registry.npm.taobao.org/babel-loader/download/babel-loader-8.1.0.tgz?cache=0&sync_timestamp=1584717315701&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbabel-loader%2Fdownload%2Fbabel-loader-8.1.0.tgz",
@ -2291,27 +2278,6 @@
"object.assign": "^4.1.0" "object.assign": "^4.1.0"
} }
}, },
"babel-runtime": {
"version": "6.26.0",
"resolved": "https://registry.npm.taobao.org/babel-runtime/download/babel-runtime-6.26.0.tgz",
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
"requires": {
"core-js": "^2.4.0",
"regenerator-runtime": "^0.11.0"
},
"dependencies": {
"core-js": {
"version": "2.6.11",
"resolved": "https://registry.npm.taobao.org/core-js/download/core-js-2.6.11.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcore-js%2Fdownload%2Fcore-js-2.6.11.tgz",
"integrity": "sha1-OIMUafmSK97Y7iHJ3EaYXgOZMIw="
},
"regenerator-runtime": {
"version": "0.11.1",
"resolved": "https://registry.npm.taobao.org/regenerator-runtime/download/regenerator-runtime-0.11.1.tgz?cache=0&sync_timestamp=1584052392667&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fregenerator-runtime%2Fdownload%2Fregenerator-runtime-0.11.1.tgz",
"integrity": "sha1-vgWtf5v30i4Fb5cmzuUBf78Z4uk="
}
}
},
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "http://registry.npm.taobao.org/balanced-match/download/balanced-match-1.0.0.tgz", "resolved": "http://registry.npm.taobao.org/balanced-match/download/balanced-match-1.0.0.tgz",
@ -2384,11 +2350,6 @@
"integrity": "sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY=", "integrity": "sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY=",
"dev": true "dev": true
}, },
"batch-processor": {
"version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/batch-processor/download/batch-processor-1.0.0.tgz",
"integrity": "sha1-dclcMrdI4IUNEMKxaPa9vpiRrOg="
},
"bcrypt-pbkdf": { "bcrypt-pbkdf": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "http://registry.npm.taobao.org/bcrypt-pbkdf/download/bcrypt-pbkdf-1.0.2.tgz", "resolved": "http://registry.npm.taobao.org/bcrypt-pbkdf/download/bcrypt-pbkdf-1.0.2.tgz",
@ -3185,6 +3146,11 @@
"integrity": "sha1-sEM9C06chH7xiGik7xb9X8gnHEg=", "integrity": "sha1-sEM9C06chH7xiGik7xb9X8gnHEg=",
"dev": true "dev": true
}, },
"clipboard-polyfill": {
"version": "2.8.6",
"resolved": "https://registry.npm.taobao.org/clipboard-polyfill/download/clipboard-polyfill-2.8.6.tgz",
"integrity": "sha1-GdJyg/EfKTO7GHNyY7mLjJW1oPc="
},
"clipboardy": { "clipboardy": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npm.taobao.org/clipboardy/download/clipboardy-2.3.0.tgz", "resolved": "https://registry.npm.taobao.org/clipboardy/download/clipboardy-2.3.0.tgz",
@ -3952,7 +3918,8 @@
"deepmerge": { "deepmerge": {
"version": "1.5.2", "version": "1.5.2",
"resolved": "https://registry.npm.taobao.org/deepmerge/download/deepmerge-1.5.2.tgz", "resolved": "https://registry.npm.taobao.org/deepmerge/download/deepmerge-1.5.2.tgz",
"integrity": "sha1-EEmdhohEza1P7ghC34x/bwyVp1M=" "integrity": "sha1-EEmdhohEza1P7ghC34x/bwyVp1M=",
"dev": true
}, },
"default-gateway": { "default-gateway": {
"version": "5.0.5", "version": "5.0.5",
@ -4404,27 +4371,6 @@
"integrity": "sha1-nQqS3v79p8wc+IlQWLiSeV3da0E=", "integrity": "sha1-nQqS3v79p8wc+IlQWLiSeV3da0E=",
"dev": true "dev": true
}, },
"element-resize-detector": {
"version": "1.2.1",
"resolved": "https://registry.npm.taobao.org/element-resize-detector/download/element-resize-detector-1.2.1.tgz",
"integrity": "sha1-sDBRlER6SGMVXljxMyOgrvMIUdE=",
"requires": {
"batch-processor": "1.0.0"
}
},
"element-ui": {
"version": "2.13.1",
"resolved": "https://registry.npm.taobao.org/element-ui/download/element-ui-2.13.1.tgz",
"integrity": "sha1-DLGkXPJ6phxgHe++GSdArFy533w=",
"requires": {
"async-validator": "~1.8.1",
"babel-helper-vue-jsx-merge-props": "^2.0.0",
"deepmerge": "^1.2.0",
"normalize-wheel": "^1.0.1",
"resize-observer-polyfill": "^1.5.0",
"throttle-debounce": "^1.0.1"
}
},
"elliptic": { "elliptic": {
"version": "6.5.2", "version": "6.5.2",
"resolved": "https://registry.npm.taobao.org/elliptic/download/elliptic-6.5.2.tgz", "resolved": "https://registry.npm.taobao.org/elliptic/download/elliptic-6.5.2.tgz",
@ -7147,33 +7093,6 @@
"resolved": "http://registry.npm.taobao.org/isstream/download/isstream-0.1.2.tgz", "resolved": "http://registry.npm.taobao.org/isstream/download/isstream-0.1.2.tgz",
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
}, },
"iview": {
"version": "3.5.4",
"resolved": "https://registry.npm.taobao.org/iview/download/iview-3.5.4.tgz?cache=0&sync_timestamp=1575428499080&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fiview%2Fdownload%2Fiview-3.5.4.tgz",
"integrity": "sha1-1Ra5LnO2F/Lcf0WDH5kFnWmTL4I=",
"requires": {
"async-validator": "^1.12.2",
"deepmerge": "^2.2.1",
"element-resize-detector": "^1.2.0",
"js-calendar": "^1.2.3",
"lodash.throttle": "^4.1.1",
"popper.js": "^1.14.6",
"tinycolor2": "^1.4.1",
"v-click-outside-x": "^4.0.19"
},
"dependencies": {
"async-validator": {
"version": "1.12.2",
"resolved": "https://registry.npm.taobao.org/async-validator/download/async-validator-1.12.2.tgz",
"integrity": "sha1-vq5nHnF00pOLe0tp0vt+cit/1yw="
},
"deepmerge": {
"version": "2.2.1",
"resolved": "https://registry.npm.taobao.org/deepmerge/download/deepmerge-2.2.1.tgz",
"integrity": "sha1-XT/yKgHAD2RUBaL7wX0HeKGAEXA="
}
}
},
"javascript-stringify": { "javascript-stringify": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npm.taobao.org/javascript-stringify/download/javascript-stringify-2.0.1.tgz", "resolved": "https://registry.npm.taobao.org/javascript-stringify/download/javascript-stringify-2.0.1.tgz",
@ -7212,11 +7131,6 @@
"resolved": "https://registry.npm.taobao.org/js-base64/download/js-base64-2.5.2.tgz", "resolved": "https://registry.npm.taobao.org/js-base64/download/js-base64-2.5.2.tgz",
"integrity": "sha1-MTtidN2nGPcU0AszMLuubjjpAgk=" "integrity": "sha1-MTtidN2nGPcU0AszMLuubjjpAgk="
}, },
"js-calendar": {
"version": "1.2.3",
"resolved": "https://registry.npm.taobao.org/js-calendar/download/js-calendar-1.2.3.tgz",
"integrity": "sha1-pYOwZEtOaVujlPNE0QPbzHp6fT4="
},
"js-cookie": { "js-cookie": {
"version": "2.2.1", "version": "2.2.1",
"resolved": "https://registry.npm.taobao.org/js-cookie/download/js-cookie-2.2.1.tgz", "resolved": "https://registry.npm.taobao.org/js-cookie/download/js-cookie-2.2.1.tgz",
@ -7547,11 +7461,6 @@
"integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=",
"dev": true "dev": true
}, },
"lodash.throttle": {
"version": "4.1.1",
"resolved": "https://registry.npm.taobao.org/lodash.throttle/download/lodash.throttle-4.1.1.tgz",
"integrity": "sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ="
},
"lodash.transform": { "lodash.transform": {
"version": "4.6.0", "version": "4.6.0",
"resolved": "http://registry.npm.taobao.org/lodash.transform/download/lodash.transform-4.6.0.tgz", "resolved": "http://registry.npm.taobao.org/lodash.transform/download/lodash.transform-4.6.0.tgz",
@ -8305,11 +8214,6 @@
"integrity": "sha1-suHE3E98bVd0PfczpPWXjRhlBVk=", "integrity": "sha1-suHE3E98bVd0PfczpPWXjRhlBVk=",
"dev": true "dev": true
}, },
"normalize-wheel": {
"version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/normalize-wheel/download/normalize-wheel-1.0.1.tgz",
"integrity": "sha1-rsiGr/2wRQcNhWRH32Ls+GFG7EU="
},
"npm-run-path": { "npm-run-path": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npm.taobao.org/npm-run-path/download/npm-run-path-2.0.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnpm-run-path%2Fdownload%2Fnpm-run-path-2.0.2.tgz", "resolved": "https://registry.npm.taobao.org/npm-run-path/download/npm-run-path-2.0.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnpm-run-path%2Fdownload%2Fnpm-run-path-2.0.2.tgz",
@ -8945,11 +8849,6 @@
"ts-pnp": "^1.1.6" "ts-pnp": "^1.1.6"
} }
}, },
"popper.js": {
"version": "1.16.1",
"resolved": "https://registry.npm.taobao.org/popper.js/download/popper.js-1.16.1.tgz",
"integrity": "sha1-KiI8s9x7YhPXQOQDcr5A3kPmWxs="
},
"portfinder": { "portfinder": {
"version": "1.0.25", "version": "1.0.25",
"resolved": "https://registry.npm.taobao.org/portfinder/download/portfinder-1.0.25.tgz", "resolved": "https://registry.npm.taobao.org/portfinder/download/portfinder-1.0.25.tgz",
@ -10139,11 +10038,6 @@
"integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=",
"dev": true "dev": true
}, },
"resize-observer-polyfill": {
"version": "1.5.1",
"resolved": "https://registry.npm.taobao.org/resize-observer-polyfill/download/resize-observer-polyfill-1.5.1.tgz",
"integrity": "sha1-DpAg3T0hAkRY1OvSfiPkAmmBBGQ="
},
"resolve": { "resolve": {
"version": "1.17.0", "version": "1.17.0",
"resolved": "https://registry.npm.taobao.org/resolve/download/resolve-1.17.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fresolve%2Fdownload%2Fresolve-1.17.0.tgz", "resolved": "https://registry.npm.taobao.org/resolve/download/resolve-1.17.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fresolve%2Fdownload%2Fresolve-1.17.0.tgz",
@ -11484,11 +11378,6 @@
"neo-async": "^2.6.0" "neo-async": "^2.6.0"
} }
}, },
"throttle-debounce": {
"version": "1.1.0",
"resolved": "https://registry.npm.taobao.org/throttle-debounce/download/throttle-debounce-1.1.0.tgz",
"integrity": "sha1-UYU9o3vmihVctugns1FKPEIuic0="
},
"through": { "through": {
"version": "2.3.8", "version": "2.3.8",
"resolved": "http://registry.npm.taobao.org/through/download/through-2.3.8.tgz", "resolved": "http://registry.npm.taobao.org/through/download/through-2.3.8.tgz",
@ -11526,11 +11415,6 @@
"integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=", "integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=",
"dev": true "dev": true
}, },
"tinycolor2": {
"version": "1.4.1",
"resolved": "https://registry.npm.taobao.org/tinycolor2/download/tinycolor2-1.4.1.tgz",
"integrity": "sha1-9PrTM0R7wLB9TcjpIJ2POaisd+g="
},
"tmp": { "tmp": {
"version": "0.0.33", "version": "0.0.33",
"resolved": "https://registry.npm.taobao.org/tmp/download/tmp-0.0.33.tgz", "resolved": "https://registry.npm.taobao.org/tmp/download/tmp-0.0.33.tgz",
@ -11975,11 +11859,6 @@
"resolved": "https://registry.npm.taobao.org/uuid/download/uuid-3.4.0.tgz?cache=0&sync_timestamp=1585683718911&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fuuid%2Fdownload%2Fuuid-3.4.0.tgz", "resolved": "https://registry.npm.taobao.org/uuid/download/uuid-3.4.0.tgz?cache=0&sync_timestamp=1585683718911&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fuuid%2Fdownload%2Fuuid-3.4.0.tgz",
"integrity": "sha1-sj5DWK+oogL+ehAK8fX4g/AgB+4=" "integrity": "sha1-sj5DWK+oogL+ehAK8fX4g/AgB+4="
}, },
"v-click-outside-x": {
"version": "4.1.0",
"resolved": "https://registry.npm.taobao.org/v-click-outside-x/download/v-click-outside-x-4.1.0.tgz",
"integrity": "sha1-voJmgOLSVmaooYUzKSnUYkSqJEc="
},
"v8-compile-cache": { "v8-compile-cache": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npm.taobao.org/v8-compile-cache/download/v8-compile-cache-2.1.0.tgz", "resolved": "https://registry.npm.taobao.org/v8-compile-cache/download/v8-compile-cache-2.1.0.tgz",

View File

@ -12,9 +12,8 @@
"dependencies": { "dependencies": {
"axios": "^0.19.2", "axios": "^0.19.2",
"bulma": "^0.8.2", "bulma": "^0.8.2",
"clipboard-polyfill": "^2.8.6",
"core-js": "^3.6.4", "core-js": "^3.6.4",
"element-ui": "^2.13.1",
"iview": "^3.5.4",
"js-cookie": "^2.2.1", "js-cookie": "^2.2.1",
"markdown-it": "^10.0.0", "markdown-it": "^10.0.0",
"node-sass": "^4.14.0", "node-sass": "^4.14.0",

View File

@ -1,36 +0,0 @@
var styles = [
'https://cdn.jsdelivr.net/npm/bulma@0.8.2/css/bulma.min.css',
'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css',
'https://cdn.jsdelivr.net/npm/font-awesome@latest/css/font-awesome.min.css',
'https://cdn.jsdelivr.net/npm/font-awesome-animation@0.2.1/dist/font-awesome-animation.min.css',
'https://cloud.jsonpop.cn/go2index/vue/dist/css/app.15d37280.css',
];
var scripts = [
"https://cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.min.js",
"https://cdn.jsdelivr.net/npm/vue-i18n@8.17.3/dist/vue-i18n.min.js",
"https://cdn.jsdelivr.net/npm/vue-router@3.1.6/dist/vue-router.min.js",
"https://cdn.jsdelivr.net/npm/axios@0.19.2/dist/axios.min.js",
// 'https://cdn.jsdelivr.net/npm/brace@0.11.1/index.min.js',
// 'https://cdn.jsdelivr.net/npm/brace@0.11.1/ext/language_tools.js',
// 'https://cdn.jsdelivr.net/npm/brace@0.11.1/mode/html.js',
// 'https://cdn.jsdelivr.net/npm/brace@0.11.1/mode/javascript.js',
// 'https://cdn.jsdelivr.net/npm/brace@0.11.1/mode/less.js',
// 'https://cdn.jsdelivr.net/npm/brace@0.11.1/theme/chrome.js',
// 'https://cdn.jsdelivr.net/npm/brace@0.11.1/snippets/javascript.js',
"https://cdn.jsdelivr.net/npm/markdown-it@10.0.0/dist/markdown-it.min.js",
'https://cloud.jsonpop.cn/go2index/vue/dist/js/chunk-1ed22f12.64aeb3d6.js',
'https://cloud.jsonpop.cn/go2index/vue/dist/js/chunk-vendors.1a3ef683.js',
'https://cloud.jsonpop.cn/go2index/vue/dist/js/chunk-4850b756.160c2c8c.js',
'https://cloud.jsonpop.cn/go2index/vue/dist/js/app.f314926a.js',
'https://cloud.jsonpop.cn/go2index/vue/dist/js/chunk-56b11c46.cc8e90e1.js',
'https://cloud.jsonpop.cn/go2index/vue/dist/js/chunk-6a24b24e.b8a4da9e.js',
'https://cloud.jsonpop.cn/go2index/vue/dist/js/chunk-2d0aed92.7e4c9d1b.js',
'https://cloud.jsonpop.cn/go2index/vue/dist/js/chunk-2d2137a3.5bc616b8.js',
];
styles.forEach((item) => {
document.write(`<link rel="stylesheet" href="${item}">`);
});
scripts.forEach((item) => {
document.write(`<script src="${item}"></script>`);
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -10,10 +10,6 @@
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style"> <link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style">
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet"> <link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet">
<% } %> <% } %>
<!-- 使用 CDN 加速的 JS 文件,配置在 vue.config.js 下 -->
<% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.js[i] %>" rel="preload" as="script">
<% } %>
<title><%= htmlWebpackPlugin.options.title %></title> <title><%= htmlWebpackPlugin.options.title %></title>
<script> <script>
var authConfig = { var authConfig = {
@ -36,13 +32,14 @@
window.current_drive_order = 0; window.current_drive_order = 0;
// window.MODEL = { q: "the" }; // window.MODEL = { q: "the" };
</script> </script>
<!-- 使用 CDN 加速的 JS 文件,配置在 vue.config.js 下 -->
<% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %>
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
<% } %>
<script src="/app.js"></script>
</head> </head>
<body> <body>
<div id="app"></div>
<!-- 使用 CDN 加速的 JS 文件,配置在 vue.config.js 下 -->
<% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %>
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
<% } %>
</body> </body>
</html> </html>

View File

@ -94,6 +94,7 @@ body {
padding-top: 0; padding-top: 0;
background: hsla(0, 0%, 100%, 0.6); background: hsla(0, 0%, 100%, 0.6);
will-change: initial; will-change: initial;
z-index: 1;
.title { .title {
color: hsl(0, 0%, 4%); color: hsl(0, 0%, 4%);
@ -136,28 +137,4 @@ body {
border: 5px solid transparent; border: 5px solid transparent;
position: absolute; position: absolute;
left: 7px; left: 7px;
}
.el-table table,
tbody,
thead {
width: 100% !important;
}
.el-table colgroup {
// position: absolute;
width: 100% !important;
display: flex;
}
.el-table col {
flex: 1;
text-align: center;
}
.el-table td, .el-table th.is-leaf{
// width: 100%;
border-bottom: initial;
}
.el-table td{
&:hover{
cursor: pointer;
}
} }

View File

@ -1,7 +1,9 @@
{ {
"_name": "English", "_name": "English",
"languages": "Languages", "languages": "Languages",
"index": "Index",
"list": { "list": {
"auth": "Directory encryption, please enter password",
"title": { "title": {
"file": "File", "file": "File",
"moditime": "Modified Time", "moditime": "Modified Time",
@ -10,6 +12,7 @@
}, },
"loading": "Loading...", "loading": "Loading...",
"opt": { "opt": {
"copy": "Copy link",
"newTab": "Open a new tab", "newTab": "Open a new tab",
"download": "Download" "download": "Download"
} }

View File

@ -1,7 +1,9 @@
{ {
"_name": "简体中文", "_name": "简体中文",
"languages": "选择语言", "languages": "选择语言",
"index": "首页",
"list": { "list": {
"auth": "目录加密,请输入密码",
"title": { "title": {
"file": "文件", "file": "文件",
"moditime": "修改时间", "moditime": "修改时间",
@ -10,6 +12,7 @@
}, },
"loading": "加载中...", "loading": "加载中...",
"opt": { "opt": {
"copy": "复制链接",
"newTab": "打开新的标签页", "newTab": "打开新的标签页",
"download": "下载" "download": "下载"
} }

View File

@ -1,7 +1,9 @@
{ {
"_name": "繁体中文", "_name": "繁体中文",
"languages": "選擇語言", "languages": "選擇語言",
"index": "首頁",
"list": { "list": {
"auth": "目錄加密,請輸入密碼",
"title": { "title": {
"file": "文件", "file": "文件",
"moditime": "修改時間", "moditime": "修改時間",
@ -10,6 +12,7 @@
}, },
"loading": "加載中...", "loading": "加載中...",
"opt": { "opt": {
"copy": "復制鏈接",
"newTab": "打開新的標簽頁", "newTab": "打開新的標簽頁",
"download": "下載" "download": "下載"
} }

View File

@ -1,20 +1,12 @@
import Vue from 'vue' import Vue from 'vue'
import App from './App.vue' import App from './App.vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import iView from 'iview'
import 'iview/dist/styles/iview.css'
import axios from '@utils/axios' import axios from '@utils/axios'
import VueAxios from 'vue-axios' import VueAxios from 'vue-axios'
import router from './router' import router from './router'
import i18n from './i18n' import i18n from './i18n'
import "@/assets/style/theme/register.scss" import "@/assets/style/theme/register.scss"
document.write('<div id="app"></div>')
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.use(ElementUI)
Vue.use(iView)
Vue.use(VueAxios,axios) Vue.use(VueAxios,axios)
new Vue({ new Vue({

View File

@ -0,0 +1,29 @@
class BuildAppJSPlugin {
apply(compiler) {
// emit 是异步 hook使用 tapAsync 触及它,还可以使用 tapPromise/tap(同步)
compiler.hooks.emit.tapAsync("BuildAppJSPlugin", (compilation, callback) => {
// 在生成文件中,创建一个头部字符串:
var filelist = "In this build:\n\n";
// 遍历所有编译过的资源文件,
// 对于每个文件名称,都添加一行内容。
for (var filename in compilation.assets) {
filelist += "- " + filename + "\n";
}
// 将这个列表作为一个新的文件资源,插入到 webpack 构建中:
compilation.assets["filelist.md"] = {
source: function() {
return filelist;
},
size: function() {
return filelist.length;
},
};
callback();
});
}
}
module.exports = BuildAppJSPlugin;

View File

@ -1,46 +1,42 @@
import Vue from 'vue' import Vue from "vue";
import VueRouter from 'vue-router' import VueRouter from "vue-router";
// 路由数据 // 路由数据
import routes from './routes' import routes from "./routes";
// fix vue-router NavigationDuplicated // fix vue-router NavigationDuplicated
const VueRouterPush = VueRouter.prototype.push const VueRouterPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push (location) { VueRouter.prototype.push = function push(location) {
return VueRouterPush.call(this, location).catch(err => err) return VueRouterPush.call(this, location).catch((err) => err);
} };
const VueRouterReplace = VueRouter.prototype.replace const VueRouterReplace = VueRouter.prototype.replace;
VueRouter.prototype.replace = function replace (location) { VueRouter.prototype.replace = function replace(location) {
return VueRouterReplace.call(this, location).catch(err => err) return VueRouterReplace.call(this, location).catch((err) => err);
} };
Vue.use(VueRouter) Vue.use(VueRouter);
// 导出路由 在 main.js 里使用 // 导出路由 在 main.js 里使用
const router = new VueRouter({ const router = new VueRouter({
mode: 'history', mode: "history",
/* scrollBehavior(to,from,savePosition){ scrollBehavior(to, from, savePosition) {
if(savePosition) { return { x: 0, y: 0 };
return savePosition; },
}else{ routes,
return {x:0,y:0} });
}
}, */
routes
})
/** /**
* 路由拦截 * 路由拦截
* 权限验证 * 权限验证
*/ */
router.beforeEach(async (to, from, next) => { router.beforeEach(async (to, from, next) => {
console.log("before:") console.log("before:");
console.log(to) console.log(to);
next() next();
}) });
router.afterEach(to => { router.afterEach((to) => {
console.log("after:") console.log("after:");
console.log(to) console.log(to);
}) });
export default router export default router;

View File

@ -2,10 +2,10 @@
const _import = require('@/libs/util.import.' + process.env.NODE_ENV) const _import = require('@/libs/util.import.' + process.env.NODE_ENV)
const frameIn = [ const frameIn = [
{ path: '/:id:/*.(html|php|css|go|java|py|js|json|txt|sh|md)', component: _import('page/GoText') }, { path: '/:id:(text/.*\\.)(html|php|css|go|java|py|js|json|txt|sh|md)', component: _import('page/GoText') },
{ path: '/:id:/*.(mp4|webm|mkv)', component: _import('page/GoVideo') }, { path: '/:id:(video/.*\\.)(mp4|webm|mkv)', component: _import('page/GoVideo') },
{ path: '/:id:/*.(bmp|jpg|jpeg|png|gif)', component: _import('page/GoImg') }, { path: '/:id:(image/.*\\.)(bmp|jpg|jpeg|png|gif)', component: _import('page/GoImg') },
{ path: '/:id::cmd?(/?/??.*)', component: _import('page/GoList') }, { path: '/:id::cmd?(/?/??.*/)', component: _import('page/GoList') },
] ]
export default frameIn export default frameIn

View File

@ -24,16 +24,16 @@ const exts = [
export const checkoutPath = (path, file) => { export const checkoutPath = (path, file) => {
// 解决/css这种也会匹配的问题 // 解决/css这种也会匹配的问题
var ext = path.split(".").length > 1 ? path.split(".").pop() : ""; // var ext = path.split(".").length > 1 ? path.split(".").pop() : "";
if (exts.indexOf(`${ext}`) >= 0) { // if (exts.indexOf(`${ext}`) >= 0) {
path += "?a=view"; // path += "?a=view";
} else { // } else {
if (file.mimeType === "application/vnd.google-apps.folder") { if (file.mimeType === "application/vnd.google-apps.folder") {
if (path.substr(-1) !== "/") { if (path.substr(-1) !== "/") {
path += "/"; path += "/";
} }
} }
} // }
return path; return path;
}; };

View File

@ -4,9 +4,9 @@
<section class="section"> <section class="section">
<div class="container"> <div class="container">
<bread-crumb ref="breadcrumb"></bread-crumb> <bread-crumb ref="breadcrumb"></bread-crumb>
<!-- <keep-alive> --> <keep-alive>
<router-view></router-view> <router-view></router-view>
<!-- </keep-alive> --> </keep-alive>
<Footer></Footer> <Footer></Footer>
</div> </div>
</section> </section>

View File

@ -1,6 +1,9 @@
<template> <template>
<nav class="breadcrumb is-hidden-mobile is-hidden-touch" aria-label="breadcrumbs"> <nav class="breadcrumb is-hidden-mobile is-hidden-touch" aria-label="breadcrumbs">
<ul> <ul>
<li>
<a v-show="navs && navs.length>0" @click="go(index)">{{$t('index')}}</a>
</li>
<li <li
v-for="(item,index) in navs" v-for="(item,index) in navs"
:class="(index+1)==navs.length?'is-active':''" :class="(index+1)==navs.length?'is-active':''"
@ -37,6 +40,7 @@ export default {
}, },
render() { render() {
let path = window.location.pathname; let path = window.location.pathname;
this.index = path.match("/\\d+:/")[0]
// //
if (path.match("/[0-9]+:search")) { if (path.match("/[0-9]+:search")) {
this.navs = []; this.navs = [];
@ -53,8 +57,11 @@ export default {
} }
n = decodeURI(n); n = decodeURI(n);
p += n + "/"; p += n + "/";
if (p.match("/[0-9]+:/")[0] === p) { // if (p.match("/[0-9]+:/")[0] === p) {
n = "首页"; // n = this.$t('index');
// }
if (n.match("[0-9]+:")) {
continue;
} }
navs.push({ navs.push({
path: p, path: p,
@ -62,9 +69,6 @@ export default {
}); });
} }
this.navs = navs; this.navs = navs;
if (navs.length == 1 && navs[0].title === "首页") {
this.navs = [];
}
} }
} }
} }

View File

@ -37,7 +37,8 @@
</div> </div>
<div class="navbar-end"> <div class="navbar-end">
<!-- <div class="navbar-item is-hidden-desktop"> <!-- is-hidden-desktop -->
<!-- <div class="navbar-item">
<div class="field is-grouped"> <div class="field is-grouped">
<p class="control has-icons-left" style="width:100%;"> <p class="control has-icons-left" style="width:100%;">
<input <input

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="content"> <div class="content">
<hr/> <hr />
<figure class="image"> <figure class="image">
<img :src="imgurl" :class="!display?'is-hidden':''" @load="loading" /> <img :src="imgurl" :class="!display?'is-hidden':''" @load="loading" />
<center :class="display?'is-hidden':''"> <center :class="display?'is-hidden':''">
@ -8,7 +8,7 @@
<span class="sr-only">Loading...</span> <span class="sr-only">Loading...</span>
</center> </center>
</figure> </figure>
<hr/> <hr />
</div> </div>
</template> </template>
@ -20,16 +20,21 @@ export default {
display: false display: false
}; };
}, },
watch: {
$route(to, from) {
this.render();
}
},
mounted() { mounted() {
let path = window.location.pathname; this.render();
// 便
path = process.env.NODE_ENV === "development" ? "/api" + path : "";
this.imgurl = path;
}, },
methods: { methods: {
// render(path) { render() {
// this.imgurl = path; let path = window.location.pathname;
// }, // 便
path = process.env.NODE_ENV === "development" ? "/api" + path : "";
this.imgurl = path;
},
loading(event) { loading(event) {
if (event.target.complete == true) { if (event.target.complete == true) {
this.display = true; this.display = true;

View File

@ -1,9 +1,5 @@
<template> <template>
<div> <div>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bulma-pageloader@0.3.0/dist/css/bulma-pageloader.min.css"
/>
<headmd :option="headmd" v-show="headmd.display"></headmd> <headmd :option="headmd" v-show="headmd.display"></headmd>
<div class="golist"> <div class="golist">
<table class="table is-hoverable"> <table class="table is-hoverable">
@ -37,9 +33,9 @@
class="is-hidden-mobile is-hidden-touch" class="is-hidden-mobile is-hidden-touch"
v-if="file.mimeType!=='application/vnd.google-apps.folder'" v-if="file.mimeType!=='application/vnd.google-apps.folder'"
> >
<!-- <span class="icon" @click="copy(file.path)"> <span class="icon" @click.stop="copy(file.path)">
<i class="fa fa-copy" title="copy link" aria-hidden="true"></i> <i class="fa fa-copy faa-shake animated-hover" :title="$t('list.opt.copy')" aria-hidden="true"></i>
</span>--> </span>
<span class="icon" @click.stop="go(file,'_blank')"> <span class="icon" @click.stop="go(file,'_blank')">
<i <i
class="fa fa-external-link faa-shake animated-hover" class="fa fa-external-link faa-shake animated-hover"
@ -47,49 +43,17 @@
aria-hidden="true" aria-hidden="true"
></i> ></i>
</span> </span>
<span class="icon" @click="go(file,'down')"> <span class="icon" @click.stop="go(file,'down')">
<i class="fa fa-download faa-shake animated-hover" :title="$t('list.opt.download')"></i> <i
class="fa fa-download faa-shake animated-hover"
aria-hidden="true"
:title="$t('list.opt.download')"
></i>
</span> </span>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<!-- <el-table
:data="files"
:cell-class-name="cellClass"
:header-row-class-name="cellClass"
@cell-click="go"
>
<el-table-column prop="name" :label="$t('list.title.file')" min-width="10" sortable>
<template slot-scope="scope">
<svg class="iconfont" aria-hidden="true">
<use :xlink:href="getIcon(scope.row.mimeType)" />
</svg>
{{scope.row.name}}
</template>
</el-table-column>
<el-table-column
prop="modifiedTime"
:label="$t('list.title.moditime')"
sortable
min-width="3"
></el-table-column>
<el-table-column prop="size" :label="$t('list.title.size')" sortable min-width="2"></el-table-column>
<el-table-column :label="$t('list.title.operation')" sortable min-width="2">
<template slot-scope="scope">
<span class="icon" @click.stop="go(file,'_blank')">
<i
class="fa fa-external-link faa-shake animated-hover"
:title="$t('list.opt.newTab')"
aria-hidden="true"
></i>
</span>
<span class="icon" @click="go(file,'down')">
<i class="fa fa-download faa-shake animated-hover" :title="$t('list.opt.download')"></i>
</span>
</template>
</el-table-column>
</el-table> -->
<div v-show="files.length==0" class="has-text-centered no-content"></div> <div v-show="files.length==0" class="has-text-centered no-content"></div>
<div v-show="loading" class="pageloader is-active"> <div v-show="loading" class="pageloader is-active">
<span class="title">{{$t('list.loading')}}</span> <span class="title">{{$t('list.loading')}}</span>
@ -104,7 +68,9 @@
import { utc2beijing, formatFileSize, checkoutPath } from "@utils/AcrouUtil"; import { utc2beijing, formatFileSize, checkoutPath } from "@utils/AcrouUtil";
import axios from "@/utils/axios"; import axios from "@/utils/axios";
import Markdown from "../common/Markdown"; import Markdown from "../common/Markdown";
import * as clipboard from "clipboard-polyfill";
export default { export default {
name: "GoList",
components: { components: {
Headmd: Markdown, Headmd: Markdown,
Readmemd: Markdown Readmemd: Markdown
@ -117,6 +83,7 @@ export default {
}, },
files: [], files: [],
loading: true, loading: true,
copyTooltip: '',
icon: { icon: {
"application/vnd.google-apps.folder": "icon-morenwenjianjia", "application/vnd.google-apps.folder": "icon-morenwenjianjia",
"video/mp4": "icon-mp", "video/mp4": "icon-mp",
@ -162,7 +129,7 @@ export default {
}, },
{ {
name: this.$t("list.title.operation"), name: this.$t("list.title.operation"),
style: "width:10%", style: "width:13%",
class: "is-hidden-mobile is-hidden-touch" class: "is-hidden-mobile is-hidden-touch"
} }
]; ];
@ -245,7 +212,7 @@ export default {
}); });
}, },
checkPassword(path) { checkPassword(path) {
var pass = prompt("目录加密,请输入密码", ""); var pass = prompt(this.$t("list.auth"), "");
localStorage.setItem("password" + path, pass); localStorage.setItem("password" + path, pass);
if (pass != null && pass != "") { if (pass != null && pass != "") {
this.render(path); this.render(path);
@ -253,10 +220,12 @@ export default {
history.go(-1); history.go(-1);
} }
}, },
// copy(path) { copy(path) {
// path = path.replace("?a=view", ""); let origin = window.location.origin;
// // TODO path = path.replace("?a=view", "");
// }, path = origin + path;
clipboard.writeText(path);
},
go(file, target) { go(file, target) {
let path = file.path; let path = file.path;
if (path.match("/[0-9]+:search/")) { if (path.match("/[0-9]+:search/")) {
@ -275,6 +244,14 @@ export default {
path: path path: path
}); });
} }
/* else if (path.substr(-1) == "/" && path.indexOf("?a=view") > 0) {
this.$router.push({
path: path
});
} else {
location.href = path;
} */
}, },
goSearchResult(file, target) { goSearchResult(file, target) {
this.loading = true; this.loading = true;

22
src/views/page/GoPdf.vue Normal file
View File

@ -0,0 +1,22 @@
<template>
<object :data="url" type="application/pdf" name="test.pdf">
<embed :src="url" type="application/pdf" />
</object>
</template>
<script>
export default {
data: function() {
return {};
},
mounted() {},
watch: {
$route: "render"
},
methods: {
render() {
let path = window.location.pathname;
}
}
};
</script>

View File

@ -1,11 +0,0 @@
<template>
<div class="card">324567</div>
</template>
<script>
export default {
data () {
return {
}
}
}
</script>

View File

@ -13,52 +13,35 @@
</template> </template>
<script> <script>
import { get_file } from "@utils/AcrouUtil" import { get_file } from "@utils/AcrouUtil";
export default { export default {
// props: { data: function() {
// option: {
// path: "",
// file: {},
// },
// },
// watch: {
// option () {
// this.content = "...";
// get_file(this.option, (data) => {
// this.content = data;
// });
// },
// },
data: function () {
return { return {
path: "", path: "",
content: "" content: ""
}; };
}, },
// watch: { watch: {
// '$route' (to, from) { $route(to, from) {
// this.content = "..."; this.render();
// get_file({path: to.replace('?a=view','/'),file: {}}, (data) => { }
// this.content = data; },
// });
// }
// },
created() { created() {
this.render() this.render();
}, },
components: { components: {
editor: require('@/components/ace-editor'), editor: require("@/components/ace-editor")
}, },
methods: { methods: {
render() { render() {
let path = window.location.pathname let path = window.location.pathname;
this.content = this.$t('page.text.loading'); this.content = this.$t("page.text.loading");
get_file({path: path.replace('?a=view','/'),file: {}}, (data) => { get_file({ path: path.replace("?a=view", "/"), file: {} }, data => {
this.content = data; this.content = data;
}); });
}, },
editorInit (editor) { editorInit(editor) {
editor.setFontSize(18) editor.setFontSize(18);
editor.session.setUseWrapMode(false); editor.session.setUseWrapMode(false);
require("brace/ext/language_tools"); //language extension prerequsite... require("brace/ext/language_tools"); //language extension prerequsite...
require("brace/mode/html"); require("brace/mode/html");
@ -66,7 +49,7 @@ export default {
require("brace/mode/less"); require("brace/mode/less");
require("brace/theme/chrome"); require("brace/theme/chrome");
require("brace/snippets/javascript"); //snippet require("brace/snippets/javascript"); //snippet
}, }
} }
} };
</script> </script>

View File

@ -94,16 +94,20 @@ export default {
}; };
}, },
methods: { methods: {
// render (path) { render() {
// this.videourl = window.location.origin + path; // 便
// this.apiurl = this.videourl = window.location.origin + window.location.pathname;
// "https://api.jsonpop.cn/demo/blplyaer/?url=" + this.videourl; this.apiurl =
// }, "https://api.jsonpop.cn/demo/blplyaer/?url=" + this.videourl;
}
}, },
mounted() { mounted() {
// 便 this.render();
this.videourl = window.location.origin + window.location.pathname; },
this.apiurl = "https://api.jsonpop.cn/demo/blplyaer/?url=" + this.videourl; watch: {
$route(to, from) {
this.render();
}
}, },
computed: { computed: {
getThunder() { getThunder() {

View File

@ -1,5 +1,6 @@
const path = require("path"); const path = require("path");
const cdnDependencies = require("./dependencies-cdn"); const cdnDependencies = require("./dependencies-cdn");
const BuildAppJSPlugin = require("./buildAppJSPlugin");
function resolve(dir) { function resolve(dir) {
return path.join(__dirname, dir); return path.join(__dirname, dir);
@ -32,6 +33,7 @@ module.exports = {
}, },
chainWebpack: (config) => { chainWebpack: (config) => {
config.plugin("BuildAppJSPlugin").use(BuildAppJSPlugin);
/** /**
* 添加 CDN 参数到 htmlWebpackPlugin 配置中 * 添加 CDN 参数到 htmlWebpackPlugin 配置中
*/ */
@ -40,9 +42,10 @@ module.exports = {
args[0].cdn = cdn; args[0].cdn = cdn;
} else { } else {
args[0].cdn = { args[0].cdn = {
css: cdnDependencies.filter((e) => e.name==="").map((e) => e.css), css: cdnDependencies.filter((e) => e.name === "").map((e) => e.css),
}; };
} }
args[0].inject = false
return args; return args;
}); });
config.resolve.alias config.resolve.alias