diff --git a/src/App.vue b/src/App.vue index 5bf5d92..e327764 100644 --- a/src/App.vue +++ b/src/App.vue @@ -26,4 +26,8 @@ font-size: 28rpx; color: #666; } + image{ + /* 宽度等于父盒子的宽度, 才不会主动撑开 */ + Width:100%; + } diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index f88cc8d..c8ffa03 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -10,6 +10,14 @@ + + + + + + + + @@ -17,12 +25,16 @@ export default { data() { return { - swiperList: [] + swiperList: [], + catitems: [] } }, // 页面生命周期 onLoad() { - this.getSwiper(); + // 获取轮播图 + this.getSwiper() + // 获取导航图 + this.getCatitems() }, methods: { // getSwiper(){ @@ -32,15 +44,23 @@ // }) // } + // 轮播图 async getSwiper(){ const { message } = await this.$u.api.getSwiperdata() this.swiperList = message.map(v=>({...v,image:v.image_src})) - } + }, + + // 导航 + async getCatitems(){ + const { message } = await this.$u.api.getCatitems() + this.catitems = message + } } }