watertao / teemo Goto Github PK
View Code? Open in Web Editor NEWA scaffold for developing SPA admin console based on react with antd
A scaffold for developing SPA admin console based on react with antd
过多的菜单组层级对于菜单的体验很差,所以需要限定支持的层数,个人感觉2层就足够了,一方面不会影响到体验,一方面2层对于绝大部分系统来说已经足够对菜单进行分类了。
第一层采用 antd pro 原生的可折叠的形式,第二层则以antd 的 Menu.ItemGroup 的方式呈现。
每次有新模块上线,在对应菜单项中增加 new
标签用于表明这是自最近一次迭代以来新增的功能。
在 menu.config.js 中增加一个配置项,用于配置标签:
// file: menu.config.js
export default [
{ type: 'module', id: 'authority.user-mgnt', icon: 'profile', 'label': 'new!' }
]
在渲染菜单时,根据 label 的取值 ,来决定是否显示标签以及标签的内容
头像图标使用圆形,里面填充姓名的拼音首字母。
尝试使用 AST 分析 Service 注解,获得Service方法需要在哪些模块或事件(event)中使用,依次关联模块或事件与资源之间的关联。
module.config.js 会变成如下:
export default {
authority: {
events: [
{ code: 'create-user', name: '创建用户' }
],
}
}
xxx.service.js 会变成如下:
import { get, post, delete, put } from '@/utils/rest-accessor',
@entry
@event('create-user')
export createUser = (userObj) => {
post('/users', userObj);
}
@entry
意味着这个 service 方法在进入模块时必须使用此方法的。
@event
意味着这个 service 方法在执行事件 create-user 时会被使用。
注意:某些资源是公开的,而注解无法识别某个资源是否是公开的,若是公开的,意味着在 currentUser 的 resources 列表中是没有的,因此在根据注解对模块或事件与资源做关联时要过滤掉那些无需权限的公开资源。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.