sanmu
authored
|
1
2
|
<template>
<v-container>
|
sanmu
authored
|
3
4
5
6
7
8
9
10
11
12
13
14
|
<div class="container">
<v-row class="ma-0 pl-4 bg-grey-lighten-3 tw-leading-[64px] row">
<div
class="tw-pr-0 tw-font-bold tw-w-[160px] tw-h-[36px] tw-leading-[64px] text-grey-darken-3"
>
CATEGORY:
</div>
<v-col class="flex pa-0">
<span
:class="
categoryStore.selectedCategory === item.categoryDisplayName ? 'active tab' : 'tab'
"
|
sanmu
authored
|
15
16
17
18
|
v-for="(item, index) in categoryStore.list"
:key="index"
@click="handleCategoryClick(item)"
>
|
sanmu
authored
|
19
20
|
<b class="tw-m-0 tw-inline">{{ item.categoryDisplayName }}</b>
</span>
|
sanmu
authored
|
21
22
|
</v-col>
</v-row>
|
sanmu
authored
|
23
|
<v-row class="pa-4 ma-0 bg-grey-lighten-4">
|
sanmu
authored
|
24
|
<div
|
sanmu
authored
|
25
|
class="tw-pr-0 tw-font-bold tw-w-[130px] tw-h-[36px] tw-leading-[36px] text-grey-darken-3"
|
sanmu
authored
|
26
27
28
|
>
DEVICE TYPE:
</div>
|
sanmu
authored
|
29
|
<v-col class="pa-0">
|
sanmu
authored
|
30
31
32
33
34
35
|
<span
:class="
categoryStore.selectedSubCategory === item.id
? 'active subTab text-body-1'
: 'subTab text-body-1'
"
|
sanmu
authored
|
36
37
38
39
40
|
v-for="(item, index) in subCategoryList"
:key="index"
@click="handleSubCategoryClick(item.id)"
>
{{ item.name }}
|
sanmu
authored
|
41
|
</span>
|
sanmu
authored
|
42
43
|
</v-col>
</v-row>
|
sanmu
authored
|
44
|
<v-row v-if="funcCategoryList.length" class="pa-4 ma-0 bg-grey-lighten-4 material">
|
sanmu
authored
|
45
46
47
48
49
|
<div
class="tw-pr-0 tw-font-bold tw-w-[210px] tw-h-[36px] tw-leading-[36px] text-grey-darken-3"
>
MATERIAL FUNCTION:
</div>
|
sanmu
authored
|
50
|
<v-col class="pa-0">
|
sanmu
authored
|
51
52
53
54
55
56
|
<span
:class="
categoryStore.selectedFuncCategory === item.id
? 'active subTab text-body-1'
: 'subTab text-body-1'
"
|
sanmu
authored
|
57
58
59
60
61
|
v-for="(item, index) in funcCategoryList"
:key="index"
@click="handleFuncCategoryClick(item.id)"
>
{{ item.name }}
|
sanmu
authored
|
62
|
</span>
|
sanmu
authored
|
63
64
|
</v-col>
</v-row>
|
sanmu
authored
|
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
</div>
</v-container>
</template>
<script setup lang="ts">
import { useCategoryStore } from '@/stores/category'
import type { CategoryRootType } from '@/type'
import { computed } from 'vue'
const categoryStore = useCategoryStore()
const handleCategoryClick = (item: CategoryRootType) => {
categoryStore.updateCategory(item.categoryDisplayName)
categoryStore.updateSubCategory(item.list[0].id)
}
const handleSubCategoryClick = (value: string) => {
categoryStore.updateSubCategory(value)
}
|
sanmu
authored
|
85
86
87
88
|
const handleFuncCategoryClick = (value: string) => {
categoryStore.updateFuncCategory(value)
}
|
sanmu
authored
|
89
90
91
92
93
94
95
96
97
|
const subCategoryList = computed(() => {
if (categoryStore.selectedCategory) {
const tmp = categoryStore.list.filter(
(item) => item.categoryDisplayName === categoryStore.selectedCategory
)
return tmp?.[0]?.list || []
}
return []
})
|
sanmu
authored
|
98
99
100
101
102
103
104
105
106
107
|
const funcCategoryList = computed(() => {
if (categoryStore.selectedCategory) {
const tmp = categoryStore.list.filter(
(item) => item.categoryDisplayName === categoryStore.selectedCategory
)
return tmp?.[0]?.productFunctions || []
}
return []
})
|
sanmu
authored
|
108
|
</script>
|
sanmu
authored
|
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
<style scoped lang="scss">
.container {
border: 1px solid #1f88e5;
}
.row {
border-bottom: 1px solid #1f88e5;
}
.tab,
.subTab {
display: inline-flex;
cursor: pointer;
margin-right: 4px;
padding: 0 16px;
&:hover,
&.active {
background: #1e88e5;
color: #fff;
}
}
.tab {
display: inline-flex;
&:hover,
&.active {
background: #1e88e5;
|
sanmu
authored
|
138
|
border-radius: 4px;
|
sanmu
authored
|
139
140
141
142
143
144
145
146
147
148
149
150
|
line-height: 50px;
color: #fff;
}
}
.subTab {
border-radius: 4px;
padding: 4px 16px;
font-weight: 500;
margin-bottom: 4px;
}
|
sanmu
authored
|
151
152
|
.material {
border-top: 1px dashed rgb(178, 178, 178);
|
sanmu
authored
|
153
154
|
}
</style>
|