Parcourir la source

refactor:修复养宠手册部分类型问题

zlong il y a 1 an
Parent
commit
5ca4ef7522
3 fichiers modifiés avec 5 ajouts et 5 suppressions
  1. 2 1
      src/api/carousal.ts
  2. 1 1
      src/model/carousals.ts
  3. 2 3
      src/pages/pet-manual/index.vue

+ 2 - 1
src/api/carousal.ts

@@ -1,7 +1,8 @@
+import type { CreateCarousalsRequest } from '@/model/carousals'
 import httpClient from '@/api/httpClient'
 
 function getCarousalList() {
-  return httpClient.get('/carousals/active-list')
+  return httpClient.get<CreateCarousalsRequest[]>('/carousals/active-list')
 }
 
 export default {

+ 1 - 1
src/model/carousals.ts

@@ -1,6 +1,6 @@
 export interface CreateCarousalsRequest {
   imageUrl: string
   targetType: string
-  targetUrl?: string
+  targetUrl: string
   targetId?: string
 }

+ 2 - 3
src/pages/pet-manual/index.vue

@@ -75,7 +75,7 @@ const listModel = ref<ListItem[]>([
 const safeHeight = ToolApi.getSafeHeight()
 const searchValue = ref<string>('')
 
-const info = ref<CreateCarousalsRequest[] | null>([
+const info = ref<CreateCarousalsRequest[]>([
   {
     imageUrl: '',
     targetId: '',
@@ -126,8 +126,7 @@ const findList = ref<{ name: string }[]>([
   { name: '猫咪尿闭怎么办' },
 ])
 async function onLoad() {
-  const getCarousalListApi = await carousalApi.getCarousalList()
-  info.value = getCarousalListApi
+  info.value = await carousalApi.getCarousalList()
 }
 function handleJumpUrl(item: CreateCarousalsRequest) {
   if (item.targetType === 'url') {