Commit 992944421d676bd004427b9081caf03b0c32f18b
1 parent
f3042649
菜单滚动事件
Showing
4 changed files
with
25 additions
and
17 deletions
src/components/horizList/horizList.vue
| ... | ... | @@ -39,6 +39,11 @@ |
| 39 | 39 | <goods-item-3 v-if="com == '3'" @jump="jump" @primary="primary" |
| 40 | 40 | :item="item"> |
| 41 | 41 | </goods-item-3> |
| 42 | + <!--菜单--> | |
| 43 | + <swiper-Item v-if="com == '4'" @jump="jump" | |
| 44 | + :item="item" | |
| 45 | + > | |
| 46 | + </swiper-Item> | |
| 42 | 47 | </div> |
| 43 | 48 | </div> |
| 44 | 49 | </div> |
| ... | ... | @@ -52,7 +57,7 @@ |
| 52 | 57 | import goodsItem1 from "@/components/goodsItem_1/goodsItem_1"; |
| 53 | 58 | import goodsItem2 from "@/components/goodsItem_2/goodsItem_2"; |
| 54 | 59 | import goodsItem3 from "@/components/goodsItem_3/goodsItem_3"; |
| 55 | - | |
| 60 | + import swiperItem from "@/components/swiperItem/swiperItem"; | |
| 56 | 61 | export default { |
| 57 | 62 | data: function () { |
| 58 | 63 | return { |
| ... | ... | @@ -64,7 +69,8 @@ |
| 64 | 69 | components: { |
| 65 | 70 | goodsItem1, |
| 66 | 71 | goodsItem2, |
| 67 | - goodsItem3 | |
| 72 | + goodsItem3, | |
| 73 | + swiperItem | |
| 68 | 74 | }, |
| 69 | 75 | methods: { |
| 70 | 76 | ... | ... |
src/components/swiperItem/swiperItem.less
| ... | ... | @@ -3,11 +3,12 @@ |
| 3 | 3 | .swiper-box { |
| 4 | 4 | position: relative; |
| 5 | 5 | width: 750px; |
| 6 | - height: 380px; | |
| 6 | + height: auto; | |
| 7 | + margin-bottom: 50px; | |
| 7 | 8 | overflow: hidden; |
| 8 | 9 | .swipe { |
| 9 | 10 | margin: 0 auto; |
| 10 | - width: 670px; | |
| 11 | + max-width: 670px; | |
| 11 | 12 | height: 100%; |
| 12 | 13 | .swipe-item { |
| 13 | 14 | width: 100%; | ... | ... |
src/components/swiperItem/swiperItem.vue
| 1 | 1 | <template> |
| 2 | - <div class="swiper-box" v-if="navs && navs.length"> | |
| 3 | - <swipe class="swipe" @change="onChange"> | |
| 4 | - <swipe-item class="swipe-item" v-for="(item, index) in navs" :key="index"> | |
| 2 | + <div class="swiper-box" v-if="item && item.length"> | |
| 3 | + <div class="swipe"> | |
| 4 | + <div class="swipe-item"> | |
| 5 | 5 | <div class="app_list_box"> |
| 6 | 6 | <div class="app_list"> |
| 7 | - <div v-for="(items, index) in item" :key="index" @click="$parent.toDetail(item)"> | |
| 7 | + <div v-for="(items, index) in item" :key="index" @click="$parent.toDetail(items)"> | |
| 8 | 8 | <img v-lazy="items.simg" /> |
| 9 | 9 | <div>{{items.title}}</div> |
| 10 | 10 | </div> |
| 11 | 11 | </div> |
| 12 | 12 | </div> |
| 13 | - </swipe-item> | |
| 14 | - </swipe> | |
| 13 | + </div> | |
| 14 | + </div> | |
| 15 | 15 | </div> |
| 16 | 16 | </template> |
| 17 | 17 | |
| ... | ... | @@ -27,7 +27,7 @@ |
| 27 | 27 | showIndicators: false |
| 28 | 28 | } |
| 29 | 29 | }, |
| 30 | - props: ["navs"], | |
| 30 | + props: ["item"], | |
| 31 | 31 | components: { |
| 32 | 32 | Swipe, |
| 33 | 33 | SwipeItem | ... | ... |
src/pages/mall/mall.vue
| ... | ... | @@ -7,10 +7,10 @@ |
| 7 | 7 | </swiper> |
| 8 | 8 | |
| 9 | 9 | <!--导航--> |
| 10 | - <swiperItem v-if="navs" | |
| 11 | - :navs="navs"> | |
| 12 | - </swiperItem> | |
| 13 | - | |
| 10 | + <horiz-list class="components-box" v-if="navs && navs.length" @jump="jump" | |
| 11 | + :lists="navs" | |
| 12 | + com="4"> | |
| 13 | + </horiz-list> | |
| 14 | 14 | <!-- 遍历ads,输出列表数据 --> |
| 15 | 15 | <div class="ads-box"> |
| 16 | 16 | <div class="ads" v-for="(item, index) in ads" :key="index"> |
| ... | ... | @@ -48,7 +48,7 @@ |
| 48 | 48 | import preferential from "@/components/preferential/preferential"; |
| 49 | 49 | import videoArea from "@/components/videoArea/videoArea"; |
| 50 | 50 | import style7 from "@/components/style_7/style_7"; |
| 51 | - | |
| 51 | + import horizList from "@/components/horizList/horizList"; | |
| 52 | 52 | export default { |
| 53 | 53 | name: 'mall', |
| 54 | 54 | data() { |
| ... | ... | @@ -65,7 +65,8 @@ |
| 65 | 65 | discountZone, |
| 66 | 66 | preferential, |
| 67 | 67 | videoArea, |
| 68 | - style7 | |
| 68 | + style7, | |
| 69 | + horizList | |
| 69 | 70 | }, |
| 70 | 71 | created() { |
| 71 | 72 | ... | ... |