|
@@ -1,24 +1,15 @@
|
|
|
<template>
|
|
|
- <div class="bar" :class="{ show,isMo }">
|
|
|
+ <div class="bar" :class="{ show, isMo }">
|
|
|
<img class="close" :src="closeICON" @click="toggleMenu" />
|
|
|
|
|
|
<!-- <template v-if="!isMo"> -->
|
|
|
|
|
|
- <Swiper
|
|
|
- :slides-per-view="slidePreview"
|
|
|
- :direction="isMo ? 'vertical':'horizontal'"
|
|
|
- :autoHeight="true"
|
|
|
+ <Swiper :slides-per-view="slidePreview" :direction="isMo ? 'vertical' : 'horizontal'" :autoHeight="true"
|
|
|
:navigation="{
|
|
|
nextEl: '.swiper-button-next',
|
|
|
prevEl: '.swiper-button-prev',
|
|
|
- }"
|
|
|
- :modules="modules"
|
|
|
- :grabCursor="true"
|
|
|
- :space-between="0"
|
|
|
- :freeMode="true"
|
|
|
- @swiper="onSwiper"
|
|
|
- @slideChange="onSlideChange"
|
|
|
- >
|
|
|
+ }" :modules="modules" :grabCursor="true" :space-between="0" :freeMode="true" @swiper="onSwiper"
|
|
|
+ @slideChange="onSlideChange">
|
|
|
<template v-for="item in lists">
|
|
|
<SwiperSlide @click="handleClick(item)">
|
|
|
<div class="cover">
|
|
@@ -31,16 +22,12 @@
|
|
|
</SwiperSlide>
|
|
|
</template>
|
|
|
</Swiper>
|
|
|
- <div
|
|
|
- class="swiper-button swiper-button-next"
|
|
|
- >
|
|
|
+ <div class="swiper-button swiper-button-next">
|
|
|
</div>
|
|
|
- <div
|
|
|
- class="swiper-button swiper-button-prev"
|
|
|
- >
|
|
|
+ <div class="swiper-button swiper-button-prev">
|
|
|
</div>
|
|
|
<!-- </template> -->
|
|
|
-
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -57,9 +44,9 @@ import { onMounted, onUnmounted } from "vue";
|
|
|
|
|
|
const data = inject("data");
|
|
|
const isMo = inject("isMo");
|
|
|
-const emits = defineEmits(["changeScene","toggleMenu"]);
|
|
|
+const emits = defineEmits(["changeScene", "toggleMenu"]);
|
|
|
const swiper = ref(null);
|
|
|
-console.log("useSwiper", swiper, useSwiper);
|
|
|
+// console.log("useSwiper", swiper, useSwiper);
|
|
|
const imagePath = ref(import.meta.env.VITE_COVER_DIR);
|
|
|
|
|
|
defineProps({
|
|
@@ -75,14 +62,14 @@ const lists = computed(() =>
|
|
|
const modules = [Navigation]
|
|
|
const slidePreview = ref(5);
|
|
|
|
|
|
-const navigation = ref({
|
|
|
- nextEl: ".swiper-button-next",
|
|
|
- prevEl: ".swiper-button-prev ",
|
|
|
-// hideOnClick: true,
|
|
|
-});
|
|
|
+// const navigation = ref({
|
|
|
+// nextEl: ".swiper-button-next",
|
|
|
+// prevEl: ".swiper-button-prev ",
|
|
|
+// // hideOnClick: true,
|
|
|
+// });
|
|
|
const handleWindowResize = () => {
|
|
|
- console.log('isMo',isMo)
|
|
|
- if(!unref(isMo)){
|
|
|
+ console.log('isMo', isMo)
|
|
|
+ if (!unref(isMo)) {
|
|
|
const innerWidth = window.innerWidth;
|
|
|
const pre = Math.ceil(innerWidth / 280);
|
|
|
console.log("slidePreview", pre);
|
|
@@ -100,15 +87,15 @@ const handleClick = (item) => {
|
|
|
emits("changeScene", item);
|
|
|
};
|
|
|
const toggleMenu = () => {
|
|
|
- emits('toggleMenu')
|
|
|
+ emits('toggleMenu')
|
|
|
}
|
|
|
onMounted(() => {
|
|
|
window.addEventListener("resize", handleWindowResize, false);
|
|
|
handleWindowResize();
|
|
|
-
|
|
|
+
|
|
|
});
|
|
|
-watch(isMo,(val)=>{
|
|
|
- if(val){
|
|
|
+watch(isMo, (val) => {
|
|
|
+ if (val) {
|
|
|
handleWindowResize();
|
|
|
}
|
|
|
})
|
|
@@ -116,9 +103,8 @@ onUnmounted(() => {
|
|
|
window.removeEventListener("resize", handleWindowResize, false);
|
|
|
});
|
|
|
|
|
|
-const onSwiper = (swiper) => {
|
|
|
- console.log('onSwiper',swiper);
|
|
|
- swiper.value = swiper;
|
|
|
+const onSwiper = (swiperObj) => {
|
|
|
+ swiper.value = swiperObj;
|
|
|
};
|
|
|
const onSlideChange = () => {
|
|
|
console.log("slide change");
|
|
@@ -137,15 +123,17 @@ const onSlideChange = () => {
|
|
|
padding-left: 15px;
|
|
|
box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.25);
|
|
|
transition: bottom 0.2s ease-in-out;
|
|
|
-// .swiper-button {
|
|
|
-// position: absolute;
|
|
|
-// top: 60px;
|
|
|
-// cursor: pointer;
|
|
|
-// }
|
|
|
+
|
|
|
+ // .swiper-button {
|
|
|
+ // position: absolute;
|
|
|
+ // top: 60px;
|
|
|
+ // cursor: pointer;
|
|
|
+ // }
|
|
|
&.show:not(.isMo) {
|
|
|
bottom: 0;
|
|
|
}
|
|
|
- .close{
|
|
|
+
|
|
|
+ .close {
|
|
|
position: absolute;
|
|
|
right: 5px;
|
|
|
top: 4px;
|
|
@@ -174,6 +162,10 @@ const onSlideChange = () => {
|
|
|
background: rgba(255, 255, 255, 0.9);
|
|
|
}
|
|
|
|
|
|
+ .swiper-button {
|
|
|
+ color: rgba(255, 255, 255, 1);
|
|
|
+ }
|
|
|
+
|
|
|
.swiper-slide {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
@@ -216,39 +208,50 @@ const onSlideChange = () => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
&.isMo {
|
|
|
bottom: 0;
|
|
|
- right:-100%;
|
|
|
- height:100%;
|
|
|
- width:203px;
|
|
|
- left:initial;
|
|
|
+ right: -100%;
|
|
|
+ height: 100%;
|
|
|
+ width: 203px;
|
|
|
+ left: initial;
|
|
|
transition: right 0.2s ease-in-out;
|
|
|
- &.show{
|
|
|
- right:0;
|
|
|
+
|
|
|
+ &.show {
|
|
|
+ right: 0;
|
|
|
}
|
|
|
+
|
|
|
background: rgba(1, 144, 64, 0.9);
|
|
|
- &::before, &::after{
|
|
|
+
|
|
|
+ &::before,
|
|
|
+ &::after {
|
|
|
background: none;
|
|
|
}
|
|
|
- .swiper-button{
|
|
|
- display:none;
|
|
|
+
|
|
|
+ .swiper-button {
|
|
|
+ display: none;
|
|
|
}
|
|
|
+
|
|
|
.swiper {
|
|
|
- height:100%;
|
|
|
+ height: 100%;
|
|
|
|
|
|
}
|
|
|
-
|
|
|
- .swiper-slide{
|
|
|
- .cover,.desc{
|
|
|
- width:100%;
|
|
|
- color:white;
|
|
|
- }
|
|
|
- .cover{
|
|
|
- min-height:125px;
|
|
|
- }
|
|
|
- span.sub {
|
|
|
+
|
|
|
+ .swiper-slide {
|
|
|
+
|
|
|
+ .cover,
|
|
|
+ .desc {
|
|
|
+ width: 100%;
|
|
|
+ color: white;
|
|
|
+ }
|
|
|
+
|
|
|
+ .cover {
|
|
|
+ min-height: 125px;
|
|
|
+ }
|
|
|
+
|
|
|
+ span.sub {
|
|
|
font-size: 12px;
|
|
|
- line-height:clear
|
|
|
+ line-height: 24px;
|
|
|
text-wrap: nowrap;
|
|
|
font-weight: normal;
|
|
|
}
|