1
0

添加隐藏文章属性

This commit is contained in:
2022-03-05 19:56:14 +08:00
parent 9909607abd
commit ade7c4254e

View File

@@ -40,6 +40,7 @@
<!-- 内容项 --> <!-- 内容项 -->
<b-menu-item <b-menu-item
v-for="item in category.items" v-for="item in category.items"
v-show="!item.isHide"
:key="item.name" :key="item.name"
:active="( :active="(
category.name === contentInfo.category && item.name === contentInfo.itemName category.name === contentInfo.category && item.name === contentInfo.itemName
@@ -132,6 +133,7 @@ export default {
title: '', title: '',
createdAt: '', createdAt: '',
updatedAt: '', updatedAt: '',
isHide: true,
}], }],
isHide: true, isHide: true,
isExpanded: false, isExpanded: false,
@@ -201,21 +203,31 @@ export default {
return; return;
} }
// 获取分类信息
const { const {
name: categoryName, name: categoryName,
label: categoryLabel, label: categoryLabel,
} = category; } = category;
category.items.forEach((item) => { category.items.forEach((item) => {
if (item.isHide) {
return;
}
// 设置文章信息
item['categoryName'] = categoryName; item['categoryName'] = categoryName;
item['categoryLabel'] = categoryLabel; item['categoryLabel'] = categoryLabel;
item['itemName'] = item.name; item['itemName'] = item.name;
item['itemLabel'] = item.title; item['itemLabel'] = item.title;
result.push(item); result.push(item);
}); });
}); });
// 按创建日期倒序排序
result.sort((a, b) => { result.sort((a, b) => {
const dateA = (a.createdAt || ''); const dateA = (a.createdAt || '');