js_reverse/学习VUE/hello_vue3/笔记/将组建中了逻辑模块化hooks-useDog.ts
2024-11-01 17:19:24 +08:00

15 lines
371 B
TypeScript

import { reactive } from 'vue'
import axios from 'axios'
export const dogList = reactive([
'https://images.dog.ceo/breeds/spaniel-irish/n02102973_2902.jpg'
])
export async function changeImg() {
try {
const res = await axios.get("https://dog.ceo/api/breeds/image/random")
dogList.push(res.data.message)
} catch (e) {
alert(e)
}
}