-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature-1134][admin] Task directory supports flexible sorting #3440
Conversation
我认为前端使用 menu 组件即可 可以设置 children 属性,改变时 拿到 key 更新状态,触发后端接口调用(入参) 用级联组件不是特别合适 |
不好意思,我之前没写过前端,不太清楚 menu 和 cascader 的区别,我这里是认为 menu 适用于导航链接类的,cascader 适用于分类选择类的,所以选用的 cascader。方便请教一下他们各自的适用场景,以及这里为什么 menu 比 cascader 更合适的原因吗? |
简单来说 menu 只需要在点击的时候拿到 key 即可 不需要做任何处理 , 在这个场景下,枚举值其实是固定的 ,不需要拼接处理,所以直接拿到key 然后更新状态 再触发接口调用, 链路更短, 而且我看你这里需要设定两个状态,但其实只需要一个状态即可 |
为什么会新增一个
|
* @return A list of {@link CascaderVO} objects representing the catalogue sort type. | ||
*/ | ||
@Override | ||
public List<CascaderVO> getCatalogueSortType() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果返回这种结构的数据前端会有一些问题,比如树列表渲染逻辑需要重写,否则会有一些未知问题,由此会带来右键或者单击节点情况下无法获取/更新状态等一系列问题
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
明白,我这里为了后续扩展其他的排序类型,做成动态的了,所以加了个 getCatalogueSortType 接口获取当前所有的排序规则用来渲染目前的排序级联列表,后续只需要改后端就可以增加排序类型和对应的排序逻辑,现在所有枚举都是维护在后端。 |
综合上面说的,我把前端的 cascader 组件改为 menu 组件,同时修改对应的接口 getCatalogueSortType 的返回值结构。 |
可以 |
好的 这个确实,点赞 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
[Feature-1134][feat] Task directory supports flexible sorting
This closes #1134