Skip to content

Commit 7850c6e

Browse files
committed
添加轮播
1 parent 71862d1 commit 7850c6e

File tree

4 files changed

+51
-6
lines changed

4 files changed

+51
-6
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ coverage
2727
*.sln
2828
*.sw?
2929
components.d.ts
30+
yarn.lock

src/components/Layout/Layout.vue

+7-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ import LayoutLeftMenu from '@/components/Layout/components/LayoutLeftMenu.vue';
44
</script>
55

66
<template>
7-
<div :class="['transition-colors','duration-300']">
7+
<div
8+
style="width: 75vw;margin: auto;"
9+
:class="['transition-colors','duration-300']"
10+
>
811
<base-header />
9-
<layout-left-menu />
12+
<div>
13+
<layout-left-menu />
14+
</div>
1015
</div>
1116
</template>
1217

src/index.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@apply bg-zinc-50 dark:bg-black
1515
}
1616
.bg-second-main{
17-
@apply bg-zinc-200 dark:bg-secondBack;
17+
@apply bg-zinc-100 dark:bg-secondBack;
1818
}
1919
::-webkit-scrollbar {
2020
display: none;

src/views/RecommendSongListView.vue

+42-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,52 @@
11
<script setup lang="ts">
2-
2+
import { computed, ref } from 'vue';
3+
const effectRef = ref<'slide' | 'fade' | 'card'>('slide');
4+
const isCardRef = computed(() => effectRef.value === 'card');
35
</script>
46

57
<template>
68
<div>
7-
Song List
9+
<n-carousel
10+
effect="card"
11+
draggable
12+
prev-slide-style="transform: translateX(-150%) translateZ(-800px);"
13+
next-slide-style="transform: translateX(50%) translateZ(-800px);"
14+
style="height: 240px"
15+
:show-dots="true"
16+
>
17+
<n-carousel-item :style="{ width: '50%' }">
18+
<img
19+
class="carousel-img"
20+
src="https://naive-ui.oss-cn-beijing.aliyuncs.com/carousel-img/carousel1.jpeg"
21+
>
22+
</n-carousel-item>
23+
<n-carousel-item :style="{ width: '55%' }">
24+
<img
25+
class="carousel-img"
26+
src="https://naive-ui.oss-cn-beijing.aliyuncs.com/carousel-img/carousel2.jpeg"
27+
>
28+
</n-carousel-item>
29+
<n-carousel-item :style="{ width: '55%' }">
30+
<img
31+
class="carousel-img"
32+
src="https://naive-ui.oss-cn-beijing.aliyuncs.com/carousel-img/carousel3.jpeg"
33+
>
34+
</n-carousel-item>
35+
<n-carousel-item :style="{ width: '55%' }">
36+
<img
37+
class="carousel-img"
38+
src="https://naive-ui.oss-cn-beijing.aliyuncs.com/carousel-img/carousel4.jpeg"
39+
>
40+
</n-carousel-item>
41+
</n-carousel>
842
</div>
943
</template>
1044

1145
<style scoped>
12-
46+
.carousel-img {
47+
margin: 0 auto;
48+
width: 100%;
49+
height: 100%;
50+
object-fit: cover;
51+
}
1352
</style>

0 commit comments

Comments
 (0)