Comments (8)
感谢更新,但是功能实现有些问题,我看了下代码,下面这一段mode为function与字符串的情况不是等价的。
const titleSort = (obj, mode, key = "filename") => Object.values(obj).forEach(s => {
if (typeof mode === "function") {
return s.sort(mode);
}
s.sort((SORT_OPTIONS[mode] || SORT_OPTIONS["asc"])(key))
});
应该是:
if (typeof mode === "function") {
return s.sort(mode(key));
}
以解构高阶。
BTW,如果必须要实现高阶的目的是为了指定一个key值的话,那为什么不把key导出来呢?
from vuepress-plugin-auto-sidebar.
好的,感谢您的意见,大概晚上更新一下。
from vuepress-plugin-auto-sidebar.
你是对的,我搞错了。
导出 key 暂时没有好的思路。
from vuepress-plugin-auto-sidebar.
你 closed 的 pr 我可以 reopen 吗
from vuepress-plugin-auto-sidebar.
你 closed 的 pr 我可以 reopen 吗
嗯嗯可以的。
from vuepress-plugin-auto-sidebar.
关于导出key,我的想法是,将导出的排序规则对象化。利用重载判断sort还是挺难维护的。
大概长成这样
interface sortOptions {
sortMode: 'asc' || 'desc' || 'custom',
sortFn?: Function,
sortKey: String
}
但这可能包含一个breaking change,所以需要你取舍一下啦
from vuepress-plugin-auto-sidebar.
请问可以按时间排序么?谢谢
from vuepress-plugin-auto-sidebar.
请问可以按时间排序么?谢谢
已支持,可以指定 sort 的 mode 为 created_time_asc 或 created_time_desc。
from vuepress-plugin-auto-sidebar.
Related Issues (20)
- title->map配置未生效 HOT 3
- 关于侧边栏及自动侧边栏问题? HOT 2
- 无法生成nav.js文件
- build error: No matching page found for sidebar item "/implementation/Theme.TheAdmin/index" HOT 2
- 自行引入生成的 sidebar.js 文件,这个文件需要先运行命令生成 HOT 2
- 如何把当前目录的文件,以及子目录都显示在sidebar呢? HOT 4
- 建议:自动合并现有的sidebar配置 HOT 2
- 默认分组 HOT 2
- 打包后部署到nginx,侧边栏就没了,开发环境正常 HOT 5
- 如何隐藏文件夹的名字 HOT 1
- 请问可以支持嵌套分组吗 HOT 1
- Sidebar not being generated HOT 2
- 请问该插件在Vuepress 2.x版本中该如何使用呢?文档上迁移那里还是空白,是还没有支持嘛? HOT 6
- "docs:nav": "vuepress nav docs" 命令执行失败 HOT 1
- 侧边栏
- 侧边栏autoGroup 无法设置展示顺序或者优先级么? HOT 1
- 侧面栏空分组隐藏
- collapse不会折叠三级标题
- 如何支持二级目录
- vuepress2.0版本设置了没有生效
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vuepress-plugin-auto-sidebar.