Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
project-online-fi
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
project-online-fi
Commits
0c90e95d
提交
0c90e95d
authored
1月 11, 2023
作者:
lihuihui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
8213e9f5
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
130 行增加
和
2 行删除
+130
-2
Index.vue
src/modules/shop/views/Index.vue
+129
-2
shop.ts
src/stores/shop.ts
+1
-0
没有找到文件。
src/modules/shop/views/Index.vue
浏览文件 @
0c90e95d
...
...
@@ -13,6 +13,44 @@ const handleClickTab = (val: any) => {
window
.
location
.
reload
()
}
}
//
onMounted
(()
=>
{
shopStore
.
filters
[
0
].
isActive
=
true
})
let
childMenuShow
=
$ref
(
false
)
let
menuValue
=
$ref
(
''
)
console
.
log
(
shopStore
.
filters
,
'shopStore.filters'
)
const
menuTab
=
function
(
item
:
any
)
{
if
(
!
item
.
children
)
{
for
(
let
i
=
0
;
i
<
shopStore
.
filters
.
length
;
i
++
)
{
shopStore
.
filters
[
i
].
isActive
=
false
if
(
shopStore
.
filters
[
i
].
children
)
{
shopStore
.
filters
[
i
].
children
.
map
((
c
:
any
)
=>
(
c
.
isActive
=
false
))
}
}
item
.
isActive
=
true
childMenuShow
=
false
menuValue
=
item
.
value
}
else
{
childMenuShow
=
!
childMenuShow
}
}
const
childMenuTab
=
function
(
item
:
any
,
cItem
:
any
)
{
for
(
let
i
=
0
;
i
<
shopStore
.
filters
.
length
;
i
++
)
{
shopStore
.
filters
[
i
].
isActive
=
false
if
(
shopStore
.
filters
[
i
].
children
)
{
shopStore
.
filters
[
i
].
children
.
map
((
c
:
any
)
=>
(
c
.
isActive
=
false
))
}
}
item
.
isActive
=
true
cItem
.
isActive
=
true
menuValue
=
cItem
.
value
// setTimeout(() => {
// childMenuShow = false
// }, 100)
}
</
script
>
<
template
>
...
...
@@ -50,11 +88,43 @@ const handleClickTab = (val: any) => {
</div>
<div
class=
"main_shop"
v-else
>
<img
src=
"https://webapp-pub.ezijing.com/project_online/fi/shop_banner.jpg"
class=
"shop_banner"
/>
<van-tabs>
<
!-- <
van-tabs>
<van-tab :title="item.label" v-for="(item, index) in shopStore.filters" :key="index" lazy>
<CourseList :type="item.value" :courseList="shopStore.shopList" :key="index" />
</van-tab>
</van-tabs>
</van-tabs> -->
<div
class=
"mobile-tab-box"
>
<div
:class=
"`item ${shopStore.filters[index].isActive && 'active'}`"
v-for=
"(item, index) in shopStore.filters"
:key=
"index"
>
<span
@
click=
"menuTab(item)"
>
{{ item.label }}
</span>
<div
class=
"child"
v-if=
"shopStore.filters[index]?.children && childMenuShow"
>
<div
@
click=
"childMenuTab(item, cItem)"
:class=
"`child-item ${cItem.isActive && 'active'}`"
v-for=
"(cItem, cIndex) in shopStore.filters[index]?.children"
:key=
"cIndex"
>
{{ cItem.label }}
</div>
</div>
</div>
</div>
<div
v-for=
"(item, index) in shopStore.filters"
:key=
"index"
>
<CourseList
v-if=
"menuValue === item.value"
:type=
"item.value"
:courseList=
"shopStore.shopList"
:key=
"index"
/>
<
template
v-if=
"shopStore.filters[index]?.children"
>
<div
v-for=
"(cItem, cIndex) in shopStore.filters[index]?.children"
:key=
"cIndex"
>
<CourseList
v-if=
"menuValue === cItem.value"
:type=
"cItem.value"
:courseList=
"shopStore.shopList"
:key=
"index"
/>
</div>
</
template
>
</div>
</div>
</template>
<
style
lang=
"scss"
scoped
>
...
...
@@ -213,4 +283,61 @@ const handleClickTab = (val: any) => {
:deep
(
.el-menu--horizontal
>
.el-sub-menu
.el-sub-menu__title
:hover
)
{
color
:
#535353
!
important
;
}
.mobile-tab-box
{
display
:
flex
;
justify-content
:
space-evenly
;
background
:
#fff
;
margin-bottom
:
15px
;
.item
{
padding
:
10px
;
position
:
relative
;
&
.active
{
span
{
color
:
#eda023
;
}
&
:
:
before
{
content
:
''
;
position
:
absolute
;
bottom
:
0
;
left
:
0
;
background
:
#eda023
;
width
:
100%
;
height
:
3px
;
border-radius
:
3px
;
z-index
:
9
;
}
}
.child
{
position
:
absolute
;
top
:
40px
;
left
:
50%
;
transform
:
translateX
(
-50%
);
background
:
#fff
;
padding
:
3px
8px
;
z-index
:
999
;
box-shadow
:
0
0
30px
rgba
(
0
,
0
,
0
,
0
.2
);
border-radius
:
5px
;
&
:
:
before
{
content
:
''
;
position
:
absolute
;
top
:
-8px
;
left
:
50%
;
transform
:
translateX
(
-50%
);
width
:
0
;
height
:
0
;
border-left
:
10px
solid
transparent
;
border-right
:
10px
solid
transparent
;
border-bottom
:
10px
solid
#fff
;
}
.child-item
{
font-size
:
12px
;
white-space
:
nowrap
;
padding
:
5px
0
;
&
.active
{
color
:
#eda023
;
}
}
}
}
}
</
style
>
src/stores/shop.ts
浏览文件 @
0c90e95d
...
...
@@ -5,6 +5,7 @@ interface ShopFilter {
value
:
string
children
?:
any
courseList
:
any
isActive
?:
boolean
}
type
ShopListItem
=
Record
<
string
,
any
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论