Skip to content

Commit

Permalink
feat: 发现页过滤规则
Browse files Browse the repository at this point in the history
  • Loading branch information
aooiuu committed Jun 2, 2024
1 parent de9b3a8 commit 40c5074
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
9 changes: 8 additions & 1 deletion packages/web/src/pages/pc/category/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<a-select v-model="contentType" class="mb-10">
<a-option v-for="o in CONTENT_TYPES" :key="o.value" :value="o.value">{{ o.label }}</a-option>
</a-select>
<a-input-search v-model="searchText" class="mb-10" placeholder="过滤" />

<div class="flex-1 overflow-auto">
<div v-for="r in ruleListDisplay" :key="r.id" class="" @click="changeRule(r)">
Expand Down Expand Up @@ -75,11 +76,17 @@ favoritesStore.sync();
const list = ref([]);
const contentType = ref(CONTENT_TYPE.NOVEL);
const ruleListDisplay = computed(() => rulesStore.list.filter((e) => e.enableDiscover && e.contentType === contentType.value));
const ruleId = ref('');
const rule = ref({});
const categoryList = ref([]);
const loading = ref(false);
const searchText = ref('');
const ruleListDisplay = computed(() => {
const filterContentType = rulesStore.list.filter((e) => e.enableDiscover && e.contentType === contentType.value);
if (!searchText.value) return filterContentType;
return filterContentType.filter((e) => e.name.includes(searchText.value));
});
// 分类被修改
async function changeCategory(row) {
Expand Down
10 changes: 9 additions & 1 deletion packages/web/src/pages/vscode/discover/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<a-select v-model="contentType" class="mb-10">
<a-option v-for="o in CONTENT_TYPES" :key="o.value" :value="o.value">{{ o.label }}</a-option>
</a-select>
<a-input-search v-model="searchText" class="mb-10" placeholder="过滤" />

<div class="flex-1 overflow-auto">
<div
v-for="r in ruleListDisplay"
Expand Down Expand Up @@ -63,11 +65,17 @@ favoritesStore.sync();
const list = ref([]);
const contentType = ref(CONTENT_TYPE.NOVEL);
const ruleListDisplay = computed(() => rulesStore.list.filter((e) => e.enableDiscover && e.contentType === contentType.value));
const ruleId = ref('');
const rule = ref({});
const categoryList = ref([]);
const loading = ref(false);
const searchText = ref('');
const ruleListDisplay = computed(() => {
const filterContentType = rulesStore.list.filter((e) => e.enableDiscover && e.contentType === contentType.value);
if (!searchText.value) return filterContentType;
return filterContentType.filter((e) => e.name.includes(searchText.value));
});
// 分类被修改
async function changeCategory(row) {
Expand Down

0 comments on commit 40c5074

Please sign in to comment.