mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
refactor(projects): 精简版+动态路由权限初步
This commit is contained in:
17
src/main.ts
17
src/main.ts
@ -1,29 +1,19 @@
|
||||
import { createApp } from 'vue';
|
||||
import { setupAssets } from '@/plugins';
|
||||
import { setupRouter } from '@/router';
|
||||
import { setupStore } from '@/store';
|
||||
import App from './App.vue';
|
||||
import AppProvider from './AppProvider.vue';
|
||||
import { setupStore } from './store';
|
||||
import { setupRouter } from './router';
|
||||
import { setupAssets } from './plugins';
|
||||
import { setupDirectives } from './directives';
|
||||
|
||||
function setupPlugins() {
|
||||
/** 引入静态资源 */
|
||||
setupAssets();
|
||||
}
|
||||
|
||||
async function setupApp() {
|
||||
const appProvider = createApp(AppProvider);
|
||||
const app = createApp(App);
|
||||
|
||||
// 挂载全局状态
|
||||
setupStore(app);
|
||||
|
||||
// 优先挂载一下 appProvider 解决路由守卫,Axios中可使用,LoadingBar,Dialog,Message 等之类组件
|
||||
appProvider.mount('#appProvider');
|
||||
|
||||
// 挂载自定义vue指令
|
||||
setupDirectives(app);
|
||||
|
||||
// 挂载路由
|
||||
await setupRouter(app);
|
||||
|
||||
@ -32,5 +22,4 @@ async function setupApp() {
|
||||
}
|
||||
|
||||
setupPlugins();
|
||||
|
||||
setupApp();
|
||||
|
Reference in New Issue
Block a user