diff --git a/.cz-config.js b/.cz-config.js index dc44513..1d8a6f9 100644 --- a/.cz-config.js +++ b/.cz-config.js @@ -5,39 +5,47 @@ module.exports = { types: [ { value: 'WIP', - name : '💪 WIP: 未完待续' + name: '💪 WIP: 未完待续' }, { value: 'feat', - name : '✨ feat: 新的功能' + name: '✨ feat: 新的功能' }, { value: 'fix', - name : '🐞 fix: Bug 修复' + name: '🐞 fix: Bug 修复' }, { value: 'refactor', - name : '🛠 refactor: 功能重构' + name: '🔨 refactor: 功能重构' + }, + { + value: 'perf', + name: '🌸 perf: 性能优化' }, { value: 'docs', - name : '📚 docs: 文档相关' + name: '📚 docs: 文档相关' }, { value: 'test', - name : '🏁 test: 测试相关' + name: '🏁 test: 测试相关' }, { - value: 'chore', - name : '🗯 chore: 琐碎事项' + value: 'build', + name: '🧰 build: 构建或辅助工具的变动' }, { value: 'style', - name : '💅 style: 优化代码结构或格式' + name: '💅 style: 优化代码结构或格式' }, { value: 'revert', - name : '⏪ revert: 回退 commit' + name: '⏪ revert: 回退 commit' + }, + { + value: 'chore', + name: '⚪ chore: 琐事,不属于以上任何类型' } ], diff --git a/example/.vuepress/config.js b/example/.vuepress/config.js index cd4b519..445e8d3 100644 --- a/example/.vuepress/config.js +++ b/example/.vuepress/config.js @@ -1,7 +1,7 @@ module.exports = { title: "vuepress-theme-reco", description: 'A simple and beautiful vuepress blog theme .', - dest: 'example/docs/public', + dest: 'example/public', head: [ ['link', { rel: 'icon', href: '/favicon.ico' }], ['meta', { name: 'viewport', content: 'width=device-width,initial-scale=1,user-scalable=no' }] diff --git a/packages/vuepress-theme-reco/helpers/postData.js b/packages/vuepress-theme-reco/helpers/postData.js index 8611918..95748e2 100644 --- a/packages/vuepress-theme-reco/helpers/postData.js +++ b/packages/vuepress-theme-reco/helpers/postData.js @@ -1,16 +1,14 @@ import { compareDate } from '@theme/helpers/utils' // 过滤博客数据 -export function filterPosts (posts, isTimeline, $lang) { - // 存在问题,当前函数被调用两次,第一次获取不到实例this,所以找不到 $lang,所以对这种情况做一下处理 - if ($lang === undefined) return posts +export function filterPosts (posts, isTimeline) { posts = posts.filter((item, index) => { - const { title, frontmatter: { home, date, publish, lang }} = item + const { title, frontmatter: { home, date, publish }} = item // 过滤多个分类时产生的重复数据 if (posts.indexOf(item) !== index) { return false } else { - const someConditions = home == true || title == undefined || publish === false || (lang !== undefined && lang !== $lang) + const someConditions = home == true || title == undefined || publish === false const boo = isTimeline === true ? !(someConditions || date === undefined) : !someConditions diff --git a/packages/vuepress-theme-reco/mixins/posts.js b/packages/vuepress-theme-reco/mixins/posts.js index 8d0a296..4c71405 100644 --- a/packages/vuepress-theme-reco/mixins/posts.js +++ b/packages/vuepress-theme-reco/mixins/posts.js @@ -11,7 +11,7 @@ export default { return [...allData, ...currentData.pages] }, []) - posts = filterPosts(posts, false, this.$lang) + posts = filterPosts(posts, false) sortPostsByStickyAndDate(posts) return posts @@ -20,7 +20,7 @@ export default { let pages = this.$recoPosts const formatPages = {} const formatPagesArr = [] - pages = filterPosts(pages, true, this.$lang) + pages = filterPosts(pages, true) this.pages = pages.length == 0 ? [] : pages for (let i = 0, length = pages.length; i < length; i++) { const page = pages[i]