mirror of
https://github.com/cool-team-official/cool-admin-midway-packages.git
synced 2025-12-14 23:42:48 +00:00
完善路由标签CoolTag可以单独使用
This commit is contained in:
parent
b670e8ead7
commit
0623782867
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cool-midway/core",
|
"name": "@cool-midway/core",
|
||||||
"version": "7.1.24",
|
"version": "7.1.25",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "index.d.ts",
|
"typings": "index.d.ts",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cool-midway/core",
|
"name": "@cool-midway/core",
|
||||||
"version": "7.1.24",
|
"version": "7.1.25",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"typings": "index.d.ts",
|
"typings": "index.d.ts",
|
||||||
|
|||||||
@ -20,7 +20,20 @@ import * as _ from 'lodash';
|
|||||||
export class CoolUrlTagData {
|
export class CoolUrlTagData {
|
||||||
data = {};
|
data = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化
|
||||||
|
*/
|
||||||
async init() {
|
async init() {
|
||||||
|
// 类标记
|
||||||
|
await this.classTag();
|
||||||
|
// 方法标记
|
||||||
|
await this.methodTag();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类标记
|
||||||
|
*/
|
||||||
|
async classTag() {
|
||||||
const tags = listModule(COOL_URL_TAG_KEY);
|
const tags = listModule(COOL_URL_TAG_KEY);
|
||||||
for (const controller of tags) {
|
for (const controller of tags) {
|
||||||
// class的标记
|
// class的标记
|
||||||
@ -37,18 +50,28 @@ export class CoolUrlTagData {
|
|||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// 方法标记
|
}
|
||||||
const listPropertyMetas = listPropertyDataFromClass(COOL_METHOD_TAG_KEY, controller);
|
}
|
||||||
const requestMetas = getClassMetadata(WEB_ROUTER_KEY, controller);
|
|
||||||
for (const propertyMeta of listPropertyMetas) {
|
/**
|
||||||
const _data = this.data[propertyMeta.tag] || [];
|
* 方法标记
|
||||||
const requestMeta = _.find(requestMetas, { method: propertyMeta.key })
|
*/
|
||||||
if(requestMeta){
|
async methodTag() {
|
||||||
this.data[propertyMeta.tag] = _.uniq(_data.concat(
|
const controllers = listModule(CONTROLLER_KEY);
|
||||||
controllerOption.prefix + requestMeta.path
|
for (const controller of controllers) {
|
||||||
))
|
const controllerOption = getClassMetadata(CONTROLLER_KEY, controller);
|
||||||
}
|
// 方法标记
|
||||||
}
|
const listPropertyMetas = listPropertyDataFromClass(COOL_METHOD_TAG_KEY, controller);
|
||||||
|
const requestMetas = getClassMetadata(WEB_ROUTER_KEY, controller);
|
||||||
|
for (const propertyMeta of listPropertyMetas) {
|
||||||
|
const _data = this.data[propertyMeta.tag] || [];
|
||||||
|
const requestMeta = _.find(requestMetas, { method: propertyMeta.key })
|
||||||
|
if(requestMeta){
|
||||||
|
this.data[propertyMeta.tag] = _.uniq(_data.concat(
|
||||||
|
controllerOption.prefix + requestMeta.path
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user