|
|
@@ -16,10 +16,10 @@
|
|
16
|
16
|
</ion-header>
|
|
17
|
17
|
<ion-grid>
|
|
18
|
18
|
<ion-row>
|
|
19
|
|
- <ion-col size="6" v-for="c in prods">
|
|
|
19
|
+ <ion-col size="6" v-for="(c, index) in prods" :key="index" @click="openModal">
|
|
20
|
20
|
<ion-img :src="c.cover_image_str"></ion-img>
|
|
21
|
21
|
<ion-label class="ion-text-wrap">
|
|
22
|
|
- {{ c.name }}
|
|
|
22
|
+ {{ c.name }} {{ message }}
|
|
23
|
23
|
</ion-label>
|
|
24
|
24
|
</ion-col>
|
|
25
|
25
|
</ion-row>
|
|
|
@@ -28,7 +28,9 @@
|
|
28
|
28
|
</ion-page>
|
|
29
|
29
|
</template>
|
|
30
|
30
|
<script setup lang="ts">
|
|
31
|
|
-import { IonPage, IonHeader, IonToolbar, IonTitle, IonContent, IonBackButton, IonButtons, onIonViewWillEnter, IonCard, IonCardHeader, IonCardTitle, IonCardSubtitle, IonCardContent, IonRow, IonGrid, IonCol, IonImg, IonButton, IonLabel} from '@ionic/vue';
|
|
|
31
|
+import { IonPage, IonHeader, IonToolbar, IonTitle, IonContent, IonBackButton, IonButtons, onIonViewWillEnter, IonCard, IonCardHeader, IonCardTitle, IonCardSubtitle, IonCardContent, IonRow, IonGrid, IonCol, IonImg, IonButton, IonLabel, modalController} from '@ionic/vue';
|
|
|
32
|
+
|
|
|
33
|
+import ProductDetail from '@/components/ProductDetail.vue'
|
|
32
|
34
|
|
|
33
|
35
|
import axios from 'axios';
|
|
34
|
36
|
import { API_URL } from '../api_config';
|
|
|
@@ -40,10 +42,28 @@ const { cat } = route.params;
|
|
40
|
42
|
let prods = ref([])
|
|
41
|
43
|
onIonViewWillEnter( async() => {
|
|
42
|
44
|
})
|
|
|
45
|
+
|
|
|
46
|
+let message = ''
|
|
43
|
47
|
onMounted( async() => {
|
|
44
|
48
|
console.log(cat)
|
|
45
|
49
|
const res = await axios.get(API_URL+`fn_products/?format=json&cat=${cat}`)
|
|
46
|
50
|
prods.value = res.data.results
|
|
47
|
51
|
console.log(prods)
|
|
48
|
52
|
})
|
|
|
53
|
+
|
|
|
54
|
+const openModal = async () => {
|
|
|
55
|
+ const modal = await modalController.create({
|
|
|
56
|
+ component: ProductDetail,
|
|
|
57
|
+ componentProps: {pid: 5},
|
|
|
58
|
+ });
|
|
|
59
|
+ modal.present();
|
|
|
60
|
+
|
|
|
61
|
+ const { data, role } = await modal.onWillDismiss();
|
|
|
62
|
+
|
|
|
63
|
+ if (role === 'confirm') {
|
|
|
64
|
+ console.log(data.value)
|
|
|
65
|
+ message = `Hello, ${data}!`;
|
|
|
66
|
+ console.log(message)
|
|
|
67
|
+ }
|
|
|
68
|
+}
|
|
49
|
69
|
</script>
|