no message

This commit is contained in:
2025-10-10 10:32:37 +08:00
commit d560b2ae9d
219 changed files with 20979 additions and 0 deletions

26
plugins/api.js Normal file
View File

@ -0,0 +1,26 @@
import homeApi from '~/api/home'
import aboutApi from '~/api/about'
import userApi from '~/api/user'
/**
* 将api注入到全局
*
* 在页面或组件里使用
* async mounted() {
const games = await this.$api.game.getGameList({ page: 1 })
}
async asyncData({ app }) {
const games = await app.$api.game.getGameList({ page: 1 })
},
*/
export default ({ $axios }, inject) => {
const api = {
home: homeApi($axios),
about: aboutApi($axios),
user: userApi($axios),
}
inject('api', api) // 将api注入到全局
}