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: [
{
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: 琐事,不属于以上任何类型'
}
],

View File

@ -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' }]

View File

@ -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

View File

@ -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]