mirror of
https://github.com/cool-team-official/cool-admin-midway-packages.git
synced 2026-01-26 08:53:12 +00:00
优化菜单导入
This commit is contained in:
parent
8deaa90fd4
commit
d117b84dd1
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cool-midway/core",
|
"name": "@cool-midway/core",
|
||||||
"version": "7.1.17",
|
"version": "7.1.18",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "index.d.ts",
|
"typings": "index.d.ts",
|
||||||
|
|||||||
@ -1,4 +1,14 @@
|
|||||||
import { App, Config, ILogger, IMidwayApplication, Inject, Logger, Provide, Scope, ScopeEnum } from "@midwayjs/core";
|
import {
|
||||||
|
App,
|
||||||
|
Config,
|
||||||
|
ILogger,
|
||||||
|
IMidwayApplication,
|
||||||
|
Inject,
|
||||||
|
Logger,
|
||||||
|
Provide,
|
||||||
|
Scope,
|
||||||
|
ScopeEnum,
|
||||||
|
} from "@midwayjs/core";
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { CoolModuleConfig } from "./config";
|
import { CoolModuleConfig } from "./config";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
@ -11,7 +21,6 @@ import { CoolEventManager } from "../event";
|
|||||||
@Provide()
|
@Provide()
|
||||||
@Scope(ScopeEnum.Singleton)
|
@Scope(ScopeEnum.Singleton)
|
||||||
export class CoolModuleMenu {
|
export class CoolModuleMenu {
|
||||||
|
|
||||||
@Inject()
|
@Inject()
|
||||||
coolModuleConfig: CoolModuleConfig;
|
coolModuleConfig: CoolModuleConfig;
|
||||||
|
|
||||||
@ -37,7 +46,7 @@ export class CoolModuleMenu {
|
|||||||
`${this.app.getBaseDir()}`,
|
`${this.app.getBaseDir()}`,
|
||||||
"..",
|
"..",
|
||||||
"lock",
|
"lock",
|
||||||
'menu'
|
"menu"
|
||||||
);
|
);
|
||||||
if (!fs.existsSync(importLockPath)) {
|
if (!fs.existsSync(importLockPath)) {
|
||||||
fs.mkdirSync(importLockPath, { recursive: true });
|
fs.mkdirSync(importLockPath, { recursive: true });
|
||||||
@ -49,7 +58,7 @@ export class CoolModuleMenu {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.coolEventManager.emit("onMenuImport", this.datas);
|
this.coolEventManager.emit("onMenuImport", this.datas);
|
||||||
this.coolEventManager.emit("onMenuInit", {});
|
// this.coolEventManager.emit("onMenuInit", {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +67,7 @@ export class CoolModuleMenu {
|
|||||||
* @param module
|
* @param module
|
||||||
* @param lockPath
|
* @param lockPath
|
||||||
*/
|
*/
|
||||||
async importMenu(module: string, lockPath: string){
|
async importMenu(module: string, lockPath: string) {
|
||||||
// 模块路径
|
// 模块路径
|
||||||
const modulePath = `${this.app.getBaseDir()}/modules/${module}`;
|
const modulePath = `${this.app.getBaseDir()}/modules/${module}`;
|
||||||
// json 路径
|
// json 路径
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cool-midway/core",
|
"name": "@cool-midway/core",
|
||||||
"version": "7.1.17",
|
"version": "7.1.18",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"typings": "index.d.ts",
|
"typings": "index.d.ts",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user