添加历史代码功能

This commit is contained in:
fofolee
2022-03-31 21:18:45 +08:00
parent 4d07847196
commit 27e077b56b
8 changed files with 104 additions and 36 deletions

15
src/js/importAll.js Normal file
View File

@@ -0,0 +1,15 @@
/**
* 快速导入同一目录下的所有脚本
*/
const importAll = context => {
const map = {}
for (const key of context.keys()) {
const keyArr = key.split('/')
keyArr.shift()
map[keyArr.join('.').replace(/\.js$/g, '')] = context(key)
}
return map
}
export default importAll