我有一个库vuex-rest-api的文件,该文件为api的每个部分导入了所有文件。将所有文件添加到此处有点乏味并且似乎毫无意义。有什么方法可以从./api
导入所有内容并将其自动放入Vuex.Store
对象中?如果我必须将某些文件移到目录的顶层,那就很好了。
import profile from './api/profile'
import privacyZones from './api/privacyZones'
import user from './api/user'
import activity from './api/activity'
import section from './api/section'
import sectionEfforts from './api/sectionEfforts'
import feed from './api/feed'
import admin from './api/admin'
import adminUsers from './api/admin/users'
import adminApplicationSettings from './api/admin/application_settings'
Vue.use(Vuex)
export default new Vuex.Store({
modules: {
profile,
privacyZones,
user,
activity,
section,
sectionEfforts,
feed,
admin,
adminUsers,
adminApplicationSettings
}
})