refactor: 重构faq与document页
- 将筛选器提取为单独的组件ProductFilters
This commit is contained in:
85
app/components/shared/ProductFilter.vue
Normal file
85
app/components/shared/ProductFilter.vue
Normal file
@ -0,0 +1,85 @@
|
||||
<template>
|
||||
<div class="question-category">
|
||||
<el-row :gutter="12">
|
||||
<el-col :span="8">
|
||||
<span class="select-label">产品分类</span>
|
||||
<el-select
|
||||
v-model="model.selectedType"
|
||||
placeholder="选择产品类型"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="type in productTypeOptions"
|
||||
:key="type.id"
|
||||
:label="type.name"
|
||||
:value="type.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<span class="select-label">产品系列</span>
|
||||
<el-select
|
||||
v-model="model.selectedProduct"
|
||||
placeholder="选择系列产品"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="product in productOptions"
|
||||
:key="product.id"
|
||||
:label="product.name"
|
||||
:value="product.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<span class="select-label">关键词</span>
|
||||
<el-input
|
||||
v-model="model.keyword"
|
||||
placeholder="输入关键词..."
|
||||
clearable
|
||||
:prefix-icon="Search"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Search } from '@element-plus/icons-vue';
|
||||
|
||||
defineProps({
|
||||
productTypeOptions: {
|
||||
type: Array as () => Array<{ id: number; name: string }>,
|
||||
default: () => [],
|
||||
},
|
||||
productOptions: {
|
||||
type: Array as () => Array<{ id: number; name: string }>,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
|
||||
const model = defineModel<{
|
||||
keyword: string;
|
||||
selectedType: number | null;
|
||||
selectedProduct: number | null;
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.question-category {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.select-label {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
:deep(.el-select__wrapper),
|
||||
:deep(.el-input__wrapper) {
|
||||
height: 40px;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user