Skip to content

Commit 76392a7

Browse files
committed
need to fix vert long tablet overflow
1 parent 19781d2 commit 76392a7

File tree

2 files changed

+80
-71
lines changed

2 files changed

+80
-71
lines changed

Routes/Item.js

+43-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import Swiper from 'https://unpkg.com/swiper@7/swiper-bundle.esm.browser.min.js'
2+
13
export const Item = {
24
props:[`items`,`cart`], //это переданный нам массив объектов items.
35
// Здесь к нему можно обращаться this.items
@@ -14,7 +16,6 @@ export const Item = {
1416
:data="i"
1517
@click="dynamicBigImage(i)"
1618
class="item-images-smallImage">
17-
<div class="item-slide-indicator"></div>
1819
</div>
1920
2021
</div>
@@ -25,9 +26,30 @@ export const Item = {
2526
id="big-image"
2627
class="item-images-bigImage">
2728
</div>
28-
29+
30+
<div class="item-mobile-swiper swiper" ref="carousel">
31+
<!-- Additional required wrapper -->
32+
<div class="swiper-wrapper">
33+
<!-- Slides -->
34+
<div v-for="(pic) in item?.media?.images" class="swiper-slide">
35+
<img :src="pic.image800pxUrl"
36+
alt="800">
37+
</div>
38+
39+
</div>
40+
<!-- If we need pagination -->
41+
<div class="swiper-pagination"></div>
42+
43+
<!-- If we need navigation buttons -->
44+
<div class="swiper-button-prev"></div>
45+
<div class="swiper-button-next"></div>
46+
47+
<!-- If we need scrollbar -->
48+
<!-- <div class="swiper-scrollbar"></div>-->
49+
</div>
2950
3051
</div>
52+
3153
<div class="item-infoAndOrder-box">
3254
<h2 class="item-text-name">{{item?.name?.slice(8)}}</h2>
3355
<p class="item-text-code">Код товара: {{item.id}}</p>
@@ -91,6 +113,18 @@ export const Item = {
91113
created(){
92114
},
93115
methods:{
116+
init() {
117+
const options = {
118+
pagination: {
119+
el: '.swiper-pagination'
120+
},
121+
navigation: {
122+
nextEl: '.swiper-button-next',
123+
prevEl: '.swiper-button-prev'
124+
}
125+
}
126+
const carousel = new Swiper(this.$refs.carousel, options)
127+
},
94128
//выбираем карточку товара из массива, ищем через id в роуте-парамс
95129
selectItem(){
96130
let match = {}
@@ -134,8 +168,15 @@ export const Item = {
134168
}
135169
},
136170
mounted(){
171+
this.$nextTick(() => { //что такое НекстТик ?
172+
this.init()
173+
});
137174
let preSelect= document.querySelector('select');
138175
if(preSelect){preSelect.selectedIndex = 1}
176+
177+
this.item.media.images.forEach(el => {
178+
console.log(el.image800pxUrl)
179+
})
139180
},
140181
computed:{
141182
//карточка товара - находим через функцию

styles.css

+37-69
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ path.blue{
368368
.collections-section-vFor{
369369
display: flex;
370370
flex-direction: column;
371-
margin: 10px 10px 10px 10px;
371+
margin: 10px 10px 10px 10px;
372372
}
373373

374374
/*================ ITEM ==============================*/
@@ -383,12 +383,13 @@ path.blue{
383383

384384
.item-infoAndOrder-box{
385385
width: 40%;
386-
padding:5px;
386+
padding:10px;
387387
}
388388
.item-all-images-container{
389389
width: 60%;
390390
}
391391
.item-box-for-big-image{
392+
display: flex;
392393
width: 80%;
393394
}
394395
.item-all-SmallImages-box{
@@ -397,9 +398,10 @@ path.blue{
397398
flex-direction: column;
398399
justify-content:center;
399400
}
400-
.item-slide-indicator{
401-
display:none;
401+
.item-mobile-swiper{
402+
display: none;
402403
}
404+
403405
}
404406
/*для планш гориз*/
405407
@media screen and (min-width:768px) and (max-width: 1200px) {
@@ -410,12 +412,13 @@ path.blue{
410412

411413
.item-infoAndOrder-box{
412414
width: 40%;
413-
padding:5px;
415+
padding:10px;
414416
}
415417
.item-all-images-container{
416418
width: 60%;
417419
}
418420
.item-box-for-big-image{
421+
display: flex;
419422
width: 80%;
420423
}
421424
.item-all-SmallImages-box{
@@ -424,9 +427,10 @@ path.blue{
424427
flex-direction: column;
425428
justify-content:center;
426429
}
427-
.item-slide-indicator{
428-
display:none;
430+
.item-mobile-swiper{
431+
display: none;
429432
}
433+
430434
}
431435

432436
/*для планш верт*/
@@ -437,8 +441,8 @@ path.blue{
437441
}
438442

439443
.item-infoAndOrder-box{
440-
width: 40%;
441-
padding:5px;
444+
width: 40%;
445+
padding:10px;
442446
}
443447
.item-all-images-container{
444448
display: flex;
@@ -447,6 +451,7 @@ path.blue{
447451

448452
}
449453
.item-box-for-big-image{
454+
display: flex;
450455
width:100%
451456
}
452457

@@ -457,26 +462,23 @@ path.blue{
457462
justify-content:center;
458463
}
459464

460-
.item-box-for-small-image{
461-
/*aspect-ratio: 1/1;*/
462-
/*width:260px;*/
465+
.item-mobile-swiper{
466+
display: none;
463467
}
464468

465-
.item-slide-indicator{
466-
display:none;
467-
}
468469

469470
}
470471

471472
/*длинный вариант - в столбик, но есть превьюшки*/
473+
/*---проработать длинное изображение - обрезается*/
472474
@media screen and (min-width:481px) and (max-width: 640px) {
473475
.item-whole-container{
474476
display:flex;
475477
flex-direction:column;
476478
}
477479
.item-infoAndOrder-box{
478480
width: 100%;
479-
padding:5px;
481+
padding:10px;
480482
}
481483
.item-all-images-container{
482484
display: flex;
@@ -485,6 +487,7 @@ path.blue{
485487

486488
}
487489
.item-box-for-big-image{
490+
display: flex;
488491
width:100%
489492
}
490493

@@ -495,13 +498,8 @@ path.blue{
495498
justify-content:center;
496499
}
497500

498-
.item-box-for-small-image{
499-
/*aspect-ratio: 1/1;*/
500-
/*width:260px;*/
501-
}
502-
503-
.item-slide-indicator{
504-
display:none;
501+
.item-mobile-swiper{
502+
display: none;
505503
}
506504

507505
}
@@ -513,42 +511,36 @@ path.blue{
513511
flex-direction:row;
514512
}
515513
.item-infoAndOrder-box{
516-
padding:5px;
514+
padding:10px;
517515
}
518516
.item-all-images-container{
519517
flex-direction: column-reverse;
518+
width:100%;
520519
}
521520
.item-box-for-big-image{
522-
width:100%;
521+
display:none;
522+
/*width:100%;*/
523523
}
524524
.item-all-SmallImages-box{
525-
display: flex;
526-
flex-direction: row;
527-
justify-content: center;
525+
display: none;
528526
}
529527
.item-images-smallImage{
530528
display:none;
531529
}
532-
.item-slide-indicator{
533-
width:15px;
534-
height:15px;
535-
border-radius:10px;
536-
border:1px solid orangered;
537-
background-color: grey;
538-
/*не попробовать ли подобрать цвет под кругляшки из getMainColor(item)*/
539-
margin:5px;
530+
.item-mobile-swiper{
540531

541532
}
533+
542534
}
543535

544536

545537
.item-whole-container{
546-
border: 2px solid darkolivegreen;
538+
/*border: 2px solid darkolivegreen;*/
547539
flex-wrap:wrap;
548540
}
549541

550542
.item-infoAndOrder-box{
551-
border: 2px dotted violet;
543+
/*border: 2px dotted violet;*/
552544
}
553545
.item-selectors-plus-buttons{
554546
display:flex;
@@ -580,47 +572,38 @@ path.blue{
580572
.item-all-images-container{
581573
font-size:0;
582574
display:flex;
583-
/*flex-wrap:wrap;*/
584-
border:2px dotted dodgerblue;
575+
/*border:2px dotted dodgerblue;*/
585576
}
586577
.item-box-for-big-image{
587-
/*width: 500px;*/
588578
overflow: hidden;
589-
border: 2px solid red;
579+
/*border: 2px solid red;*/
590580
aspect-ratio: 1/1;
591-
display: flex;
592581
justify-content: center;
593582
align-items: center;
594583

595584
}
596585
.item-images-bigImage{
597-
border:2px solid darkgoldenrod;
586+
/*border:2px solid darkgoldenrod;*/
598587
max-width: 100%;
599588
max-height: 100%;
600589
height: auto;
601590
}
602591

603592
.item-all-SmallImages-box{
604593
/*display: flex;в медиа*/
605-
border:2px solid lime;
594+
/*border:2px solid lime;*/
606595
}
607596

608597
.item-box-for-small-image{
609-
border: 2px solid purple;
598+
/*border: 2px solid purple;*/
610599
text-align: center;
611600
margin:5px;
612601
}
613602
.item-images-smallImage{
614-
border: 2px solid orangered;
603+
/*border: 2px solid orangered;*/
615604
max-width:100%
616605
}
617606

618-
619-
620-
621-
622-
623-
624607
/*-----------подвал-----------------------------------*/
625608
footer{
626609
background-color: ghostwhite;
@@ -724,21 +707,6 @@ footer{
724707
}
725708

726709
/*-----свайпер------------------------------*/
727-
/*html,*/
728-
/*body {*/
729-
/* position: relative;*/
730-
/* height: 100%;*/
731-
/*}*/
732-
733-
/*body {*/
734-
/* background: #eee;*/
735-
/* font-family: Helvetica Neue, Helvetica, Arial, sans-serif;*/
736-
/* font-size: 14px;*/
737-
/* color: #000;*/
738-
/* margin: 0;*/
739-
/* padding: 0;*/
740-
/*}*/
741-
742710
.swiper {
743711
width: 100%;
744712
height: 100%;
@@ -767,7 +735,7 @@ footer{
767735

768736
.swiper-slide img {
769737
display: block;
770-
/*width: 100%;*/
738+
width: 100%;
771739
/*height: 100%;*/
772740
object-fit: cover;
773741
}

0 commit comments

Comments
 (0)