Przeglądaj źródła

feature(markup): добавлена заглушка, если фото не найдено

horanchikk 10 miesięcy temu
rodzic
commit
ba0930e5db
4 zmienionych plików z 3 dodań i 2 usunięć
  1. 1 0
      composables/useApi.ts
  2. 1 1
      pages/news/[id]/index.vue
  3. 1 1
      pages/news/index.vue
  4. BIN
      public/nophoto.png

+ 1 - 0
composables/useApi.ts

@@ -63,6 +63,7 @@ export function useApi() {
       }
     },
   })
+
   const api = {
     get: function<T>(url: string, params?: object): Promise<T> {
       return instance(url, {

+ 1 - 1
pages/news/[id]/index.vue

@@ -9,7 +9,7 @@
     >
       <img
         v-if="news"
-        src="http://www.kansk-tc.ru/UserFiles/2024/10/15/2024-10-08_550px..jpeg"
+        :src="news.preview.length > 0 ? news.preview : './notfound.png'"
         class="w-full object-cover object-center absolute -z-10"
         :style="`height: ${imageHeight}px`"
       >

+ 1 - 1
pages/news/index.vue

@@ -15,7 +15,7 @@
       <WallPost
         v-for="news in newsList"
         :key="news.id"
-        :image="news.preview"
+        :image="news.preview.length > 0 ? news.preview : `/nophoto.png`"
         :title="news.title"
         :description="news.description"
         :date="news.date"

BIN
public/nophoto.png