Commit 99ee1ff70a78a3e1e71e605deacc9f92ef669355
Merge branch 'by'
Showing
2 changed files
with
25 additions
and
2 deletions
components/ProductDetail.vue
... | ... | @@ -224,6 +224,7 @@ const routeQuery = useRouteQuery(); |
224 | 224 | const dialogStore = useDialogStore(); |
225 | 225 | const href1 = ref("/products"); |
226 | 226 | const href2 = ref("/products"); |
227 | +const productStore = useProductListStore(); | |
227 | 228 | // 定义单个 item 的接口 |
228 | 229 | interface BreadcrumbItem { |
229 | 230 | title: string; // 标题 |
... | ... | @@ -265,7 +266,28 @@ const props = defineProps<{ |
265 | 266 | }>(); |
266 | 267 | const info = props.info; |
267 | 268 | watchEffect(() => { |
268 | - if (routeQuery.categories) { | |
269 | + if (info?.productCrumbsVO?.category1 && productStore.keyword) { | |
270 | + console.log(productStore.keyword, "5656keywordy"); | |
271 | + items.value[1].title = info.productCrumbsVO.category1; | |
272 | + items.value[1].href = | |
273 | + href1.value + "?categories=" + info.productCrumbsVO.category1; | |
274 | + href1.value = href1.value + "?categories=" + info.productCrumbsVO.category1; | |
275 | + if (info?.productCrumbsVO?.category2) { | |
276 | + items.value[2].title = info.productCrumbsVO.category2; | |
277 | + href2.value = href1.value + "," + info.productCrumbsVO.category2; | |
278 | + items.value[2].href = href1.value + "," + info.productCrumbsVO.category2; | |
279 | + } | |
280 | + if (info?.productCrumbsVO?.function) { | |
281 | + // items.value.push({ | |
282 | + // title: info.productCrumbsVO.function, | |
283 | + // disabled: false, | |
284 | + // href: href2.value + "&function=" + info.productCrumbsVO.function, | |
285 | + // }); | |
286 | + items.value[3].title = info.productCrumbsVO.function; | |
287 | + items.value[3].href = | |
288 | + href2.value + "&function=" + info.productCrumbsVO.function; | |
289 | + } | |
290 | + } else if (routeQuery.categories) { | |
269 | 291 | if (!routeQuery.categories.includes("Energy materials")) { |
270 | 292 | routeQuery.updateFunction("Not specified"); |
271 | 293 | } |
... | ... | @@ -298,6 +320,7 @@ watchEffect(() => { |
298 | 320 | // routeQuery.updateFunction(null); |
299 | 321 | } |
300 | 322 | } else if (info?.productCrumbsVO?.category1) { |
323 | + console.log(productStore.keyword, "5656keywordy"); | |
301 | 324 | items.value[1].title = info.productCrumbsVO.category1; |
302 | 325 | items.value[1].href = |
303 | 326 | href1.value + "?categories=" + info.productCrumbsVO.category1; | ... | ... |
pages/products/detail/[id]/index.vue
... | ... | @@ -59,7 +59,7 @@ newData.productimageliststore = |
59 | 59 | typeof newData.productimageliststore === "string" |
60 | 60 | ? JSON.parse(newData.productimageliststore) || [] |
61 | 61 | : (newData.productimageliststore as ProductImage[]); |
62 | -newData.productimageliststore = newData?.productimageliststore.map( | |
62 | +newData.productimageliststore = newData?.productimageliststore?.map( | |
63 | 63 | (item: ProductImage) => ({ |
64 | 64 | ...item, |
65 | 65 | // url: `http://112.74.45.244:8100/api/show/image?fileKey=${item.fileKey}` | ... | ... |