chore(vuepress-theme-reco): remove lang filter

This commit is contained in:
reco_luan 2020-04-03 23:20:29 +08:00
parent f78cb9ad42
commit 99755a1fa3
4 changed files with 24 additions and 18 deletions

View File

@ -5,39 +5,47 @@ module.exports = {
types: [ types: [
{ {
value: 'WIP', value: 'WIP',
name : '💪 WIP: 未完待续' name: '💪 WIP: 未完待续'
}, },
{ {
value: 'feat', value: 'feat',
name : '✨ feat: 新的功能' name: '✨ feat: 新的功能'
}, },
{ {
value: 'fix', value: 'fix',
name : '🐞 fix: Bug 修复' name: '🐞 fix: Bug 修复'
}, },
{ {
value: 'refactor', value: 'refactor',
name : '🛠 refactor: 功能重构' name: '🔨 refactor: 功能重构'
},
{
value: 'perf',
name: '🌸 perf: 性能优化'
}, },
{ {
value: 'docs', value: 'docs',
name : '📚 docs: 文档相关' name: '📚 docs: 文档相关'
}, },
{ {
value: 'test', value: 'test',
name : '🏁 test: 测试相关' name: '🏁 test: 测试相关'
}, },
{ {
value: 'chore', value: 'build',
name : '🗯 chore: 琐碎事项' name: '🧰 build: 构建或辅助工具的变动'
}, },
{ {
value: 'style', value: 'style',
name : '💅 style: 优化代码结构或格式' name: '💅 style: 优化代码结构或格式'
}, },
{ {
value: 'revert', value: 'revert',
name : '⏪ revert: 回退 commit' name: '⏪ revert: 回退 commit'
},
{
value: 'chore',
name: '⚪ chore: 琐事,不属于以上任何类型'
} }
], ],

View File

@ -1,7 +1,7 @@
module.exports = { module.exports = {
title: "vuepress-theme-reco", title: "vuepress-theme-reco",
description: 'A simple and beautiful vuepress blog theme .', description: 'A simple and beautiful vuepress blog theme .',
dest: 'example/docs/public', dest: 'example/public',
head: [ head: [
['link', { rel: 'icon', href: '/favicon.ico' }], ['link', { rel: 'icon', href: '/favicon.ico' }],
['meta', { name: 'viewport', content: 'width=device-width,initial-scale=1,user-scalable=no' }] ['meta', { name: 'viewport', content: 'width=device-width,initial-scale=1,user-scalable=no' }]

View File

@ -1,16 +1,14 @@
import { compareDate } from '@theme/helpers/utils' import { compareDate } from '@theme/helpers/utils'
// 过滤博客数据 // 过滤博客数据
export function filterPosts (posts, isTimeline, $lang) { export function filterPosts (posts, isTimeline) {
// 存在问题当前函数被调用两次第一次获取不到实例this所以找不到 $lang所以对这种情况做一下处理
if ($lang === undefined) return posts
posts = posts.filter((item, index) => { 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) { if (posts.indexOf(item) !== index) {
return false return false
} else { } 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 const boo = isTimeline === true
? !(someConditions || date === undefined) ? !(someConditions || date === undefined)
: !someConditions : !someConditions

View File

@ -11,7 +11,7 @@ export default {
return [...allData, ...currentData.pages] return [...allData, ...currentData.pages]
}, []) }, [])
posts = filterPosts(posts, false, this.$lang) posts = filterPosts(posts, false)
sortPostsByStickyAndDate(posts) sortPostsByStickyAndDate(posts)
return posts return posts
@ -20,7 +20,7 @@ export default {
let pages = this.$recoPosts let pages = this.$recoPosts
const formatPages = {} const formatPages = {}
const formatPagesArr = [] const formatPagesArr = []
pages = filterPosts(pages, true, this.$lang) pages = filterPosts(pages, true)
this.pages = pages.length == 0 ? [] : pages this.pages = pages.length == 0 ? [] : pages
for (let i = 0, length = pages.length; i < length; i++) { for (let i = 0, length = pages.length; i < length; i++) {
const page = pages[i] const page = pages[i]