Commit ecf065e8 authored by yyh's avatar yyh

代码结构调整

parent 6e346b7f
import file from '@/api/file';
import proof from '@/api/proof';
import template from '@/api/template';
import user from '@/api/user';
// import file from '@/api/file';
// import proof from '@/api/proof';
// import template from '@/api/template';
// import user from '@/api/user';
// export default {
// file,
// proof,
// template,
// user,
// };
const apiContext = require.context('./modules/', true, /\.ts$/ );
const apis: any = {};
apiContext.keys().forEach((key: string) => {
const apiName: string | undefined = key.split('/').pop()?.replace(/\.\w+$/, '');
apis[(apiName as string)] = apiContext(key).default;
});
export default {
file,
proof,
template,
user,
install(Vue: any) {
Vue.prototype.$api = apis;
},
};
......@@ -2,7 +2,7 @@ import { importAll } from '@/utils/utils';
const components = importAll(require.context('./', true, /\.vue$/ ));
export default {
install(Vue: any) {
Object.keys(components).forEach(key => {
Object.keys(components).forEach((key: string) => {
Vue.component(key, components[key]);
});
},
......
......@@ -2,9 +2,9 @@ import Vue from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
import api from './api';
Vue.prototype.$api = api;
import apis from './api/index';
Vue.use(apis);
import components from '@/components';
Vue.use(components);
import '@/filter';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment