diff --git a/pages/index/home.vue b/pages/index/home.vue index 9bd6b45..7d72119 100644 --- a/pages/index/home.vue +++ b/pages/index/home.vue @@ -174,18 +174,7 @@ export default { // 轮播图数据 bannerList: [ - { - image: '/static/首页背景图.png', - title: '轮播图1' - }, - { - image: '/static/默认图片.png', - title: '轮播图2' - }, - { - image: '/static/logo.png', - title: '轮播图3' - } + ], // 今日更新数据 @@ -322,14 +311,25 @@ export default { uni.navigateTo({ url: '/subPages/home/directory' }) - } + }, + async getBanner() { + const bannerRes = await this.$api.home.getBanner() + if (bannerRes.code === 200){ + this.bannerList = bannerRes.result.map(item => ({ + image: item.img, + title: item.title + })) + } + }, + }, + + async onShow() { + await this.getBanner() } }