index.vue
2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<template>
<MobileProductDetail v-if="isMobile()" :info="info" />
<ProductDetail v-else :info="info" />
</template>
<script setup lang="ts">
import { onMounted } from 'vue'
import ProductDetail from '~/components/ProductDetail.vue'
import MobileProductDetail from '~/components/MobileProductDetail.vue'
import type { Product, ProductImage } from '~/type'
import { useRoute } from 'vue-router'
const route = useRoute()
const info = ref<Partial<Product>>({
productimageliststore: [],
productAttributeList: [],
name: '',
ticketTypes: []
})
let { data: resData } = await useAsyncData('detail', () => $fetch('/shop/product/detail', {
method: 'GET',
params: {
id: route.params.id
}
}), {
server: true // 仅在服务器端获取数据
})
useHead({
title: info.name || 'canrud',
meta: [
{
name: 'title',
content:
'科路得,Equipment,High-precision,Machining center,Design,Manufacturing capabilities,Equipment supply,Production line planning,Construction services,Battery assembly lines,Pouch cell testing lines',
}, {
name: 'keywords',
content:
'科路得,Equipment,High-precision,Machining center,Design,Manufacturing capabilities,Equipment supply,Production line planning,Construction services,Battery assembly lines,Pouch cell testing lines',
}, {
name: 'description',
content:
'科路得,助您科研之路势在必得。Equipment Business: With our self-built high-precision machining center, we possess robust design and manufacturing capabilities. We offer comprehensive equipment supply, production line planning, and construction services, including battery assembly lines, pouch cell testing lines, and more. Our aim is to provide complete equipment solutions that cater to the diverse needs of our clients. Expect top-quality equipment and professional services that will help you stand out in a fiercely competitive market!'
},
],
})
const newData: Product = resData.value.data
newData.productimageliststore = typeof newData.productimageliststore === 'string' ?
(JSON.parse(newData.productimageliststore) || []) :
newData.productimageliststore as ProductImage[]
newData.productimageliststore = newData?.productimageliststore.map((item: ProductImage) => ({
...item,
// url: `http://112.74.45.244:8100/api/show/image?fileKey=${item.fileKey}`
url: `/api/show/image?fileKey=${item.fileKey}`
}))
info.value = { ...newData }
</script>