Bladeren bron

swiper in product detail

tum 2 jaren geleden
bovenliggende
commit
cb4bfcef3e
2 gewijzigde bestanden met toevoegingen van 24 en 2 verwijderingen
  1. 22 1
      src/components/ProductDetail.vue
  2. 2 1
      src/views/Tab1Page.vue

+ 22 - 1
src/components/ProductDetail.vue

19
       <!--<ion-input v-model="name" placeholder="Your name" label='xx'></ion-input>-->
19
       <!--<ion-input v-model="name" placeholder="Your name" label='xx'></ion-input>-->
20
     <!--</ion-item>-->
20
     <!--</ion-item>-->
21
     <template v-if="product">
21
     <template v-if="product">
22
-      <ion-img :src="product.cover_image_str"></ion-img>
22
+      <swiper>
23
+      <swiper-slide v-for="p in product.product_photos">
24
+          <ion-img :src="p.image"></ion-img>
25
+      </swiper-slide>
26
+      </swiper>
27
+      
28
+      <!-- <ion-img :src="product.cover_image_str"></ion-img> -->
29
+      <ion-grid class='ion-hide'>
30
+        <ion-row>
31
+            <ion-col size=3 v-for="(p,i) in product.product_photos" :key='p.id'>
32
+              <ion-img :src="p.image"></ion-img>
33
+            </ion-col>
34
+        </ion-row>
35
+      </ion-grid>
23
       <ion-text>
36
       <ion-text>
24
         <h1>{{ product.name }}</h1>
37
         <h1>{{ product.name }}</h1>
25
         <vue-showdown :markdown="product.description" />
38
         <vue-showdown :markdown="product.description" />
38
   IonButtons,
51
   IonButtons,
39
   IonButton,
52
   IonButton,
40
   IonItem,
53
   IonItem,
54
+  IonGrid,
55
+  IonRow,
56
+  IonCol,
41
   IonLabel,
57
   IonLabel,
42
   IonInput,
58
   IonInput,
43
   IonImg,
59
   IonImg,
44
   IonText,
60
   IonText,
45
   modalController,
61
   modalController,
46
   onIonViewWillEnter, 
62
   onIonViewWillEnter, 
63
+  IonThumbnail
47
 } from '@ionic/vue';
64
 } from '@ionic/vue';
48
 
65
 
49
 import { VueShowdown } from 'vue-showdown';
66
 import { VueShowdown } from 'vue-showdown';
52
 import axios from 'axios';
69
 import axios from 'axios';
53
 import { API_URL } from '@/api_config';
70
 import { API_URL } from '@/api_config';
54
 
71
 
72
+import { Swiper, SwiperSlide } from 'swiper/vue';
73
+import 'swiper/css';
74
+import '@ionic/vue/css/ionic-swiper.css';
75
+
55
 const props = defineProps(['pid'])
76
 const props = defineProps(['pid'])
56
 let pid = ref(0)
77
 let pid = ref(0)
57
 let product = ref(null)
78
 let product = ref(null)

+ 2 - 1
src/views/Tab1Page.vue

37
 
37
 
38
 import { Swiper, SwiperSlide } from 'swiper/vue';
38
 import { Swiper, SwiperSlide } from 'swiper/vue';
39
 import 'swiper/css';
39
 import 'swiper/css';
40
-import '@/theme/myapp.scss';
41
 import '@ionic/vue/css/ionic-swiper.css';
40
 import '@ionic/vue/css/ionic-swiper.css';
41
+
42
+import '@/theme/myapp.scss';
42
 import { API_URL } from '@/api_config';
43
 import { API_URL } from '@/api_config';
43
 import { ref, onMounted, reactive } from 'vue'
44
 import { ref, onMounted, reactive } from 'vue'
44
 
45