Skip to content

Commit bbc8d9f

Browse files
committed
wip: 完善左侧边栏交互
1 parent 62370fd commit bbc8d9f

File tree

2 files changed

+54
-9
lines changed

2 files changed

+54
-9
lines changed

src/components/left-panel/LeftPanel.vue

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,30 @@
1-
<script setup lang="ts"></script>
1+
<script setup lang="ts">
2+
import VideoList from './VideoList.vue'
3+
import { typeList } from './typeList'
4+
import { ref } from 'vue'
5+
6+
const activeType = ref(1)
7+
const setActiveType = (id: number) => {
8+
activeType.value = id
9+
}
10+
</script>
211
<template>
312
<div class="left-box min-w-[400px] flex bg-[#272836]">
4-
<div class="w-[60px] bg-[#1c1c26] flex flex-col gap-2 items-center">
13+
<div class="w-[60px] bg-[#1c1c26] flex flex-col items-center">
514
<div
6-
v-for="item in 7"
7-
:key="item"
8-
class="w-[50px] h-[50px] rounded-lg bg-[#17171e] text-[#ababc0] hover:text-[white] select-none flex flex-col items-center leading-[50px]"
15+
v-for="(item, index) in typeList"
16+
@click="setActiveType(item.id)"
17+
:key="index"
18+
class="h-[60px] text-sm w-[60px] hover:bg-[#272836] text-[#ababc0] hover:text-[white] select-none flex flex-col justify-center items-center cursor-pointer"
19+
:class="{ 'bg-[#272836] text-[white]': activeType === item.id }"
920
>
10-
type {{ item }}
21+
<component :is="item.icon" />
22+
{{ item.name }}
1123
</div>
1224
</div>
13-
<div class="text-white p-8">
14-
left-panel
15-
<span>( 开发中... )</span>
25+
<div class="text-white p-4 flex-1">
26+
视频素材:(开发中)
27+
<VideoList />
1628
</div>
1729
</div>
1830
</template>

src/components/left-panel/typeList.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { IconVideo, IconText, IconMusic } from '~/assets/icons/index'
2+
3+
export const typeList = [
4+
{
5+
id: 1,
6+
name: '视频',
7+
icon: IconVideo
8+
},
9+
{
10+
id: 2,
11+
name: '音频',
12+
icon: IconMusic
13+
},
14+
{
15+
id: 3,
16+
name: '文字',
17+
icon: IconText
18+
},
19+
{
20+
id: 4,
21+
name: '图片',
22+
icon: IconVideo
23+
},
24+
{
25+
id: 5,
26+
name: 'SVG',
27+
icon: IconVideo
28+
},
29+
{
30+
id: 6,
31+
name: 'GIF'
32+
}
33+
]

0 commit comments

Comments
 (0)