Browse Source

docs: 更改路径为正式环境v1.2

chenpeng 1 week ago
parent
commit
437348576b
2 changed files with 7 additions and 16 deletions
  1. 5 12
      components/common/block/catalogs.vue
  2. 2 4
      components/common/navigation/index.vue

+ 5 - 12
components/common/block/catalogs.vue

@@ -27,33 +27,26 @@ const list = ref([
 ])
 const requestUrl = `${baseURL}${Api.CatalogueList}`
 const params = { pageNo: 1, pageSize: 9, state: 1, trend: '', order: 'desc' }
-const { data, pending, error, refresh } = await useAsyncData(
+const { data, refresh } = await useAsyncData(
   'catalogue-list-s',
-  () => $fetch(requestUrl, { params }),
+  () => $fetch(requestUrl, { method: 'GET', params }),
 )
-watch(() => data.value, (newValue) => {
-  if (newValue?.result)
-    catalogueList.value = newValue?.result?.records || []
+watch(() => data.value?.result?.records, (newRecords: any[]) => {
+  if (newRecords) catalogueList.value = newRecords
 }, { immediate: true })
 
 function onVerticalSwiper(swiper: any) {
   swiperVertical.value = swiper
 }
 function onClickLeft() {
-  // swiperVertical.value.slideTo()
   swiperVertical.value.slidePrev()
 }
 function onClickRight() {
-  // swiperVertical.value.slideTo(4)
   swiperVertical.value.slideNext()
 }
 function switchCatalogs(item: any) {
   solution.value = item.key
-  if (item.key === 'category')
-    params.trend = ''
-  else
-    params.trend = '1'
-
+  params.trend = item.key === 'category' ? '' : '1'
   refresh()
 }
 </script>

+ 2 - 4
components/common/navigation/index.vue

@@ -104,9 +104,7 @@ function toCategories() {
                 :key="index"
                 class="cursor-pointer"
               >
-                <NuxtLink
-                  :to="`/blog/${item.blogSlug}`"
-                >
+                <component :is="item.blogSlug ? 'NuxtLink' : 'div'" :to="item.blogSlug ? `/blog/${item.blogSlug}` : undefined">
                   <img
                     :src="item.coverImg"
                     :alt="item.coverAlt"
@@ -115,7 +113,7 @@ function toCategories() {
                   <div class="text-14px fw-800 custom-title-font text-#333 line-clamp-1">
                     {{ item.title }}
                   </div>
-                </NuxtLink>
+                </component>
               </div>
             </div>
           </div>