From e30c8cd232bc63dd48dcebd676dd74e421916454 Mon Sep 17 00:00:00 2001 From: "jqtmviyu@gmail.com" Date: Sun, 21 Feb 2021 21:45:38 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=AF=BC=E8=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 4 ++++ src/pages/index/index.vue | 36 +++++++++++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 3 deletions(-) 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 + } } }