当前位置:   article > 正文

微信小程序:案例-本地生活(首页)_小程序中的本地生活服务背景图片

小程序中的本地生活服务背景图片

1.首页效果以及实现步骤

②配置导航栏效果

  1. "window":{
  2. "backgroundTextStyle":"light",
  3. "navigationBarBackgroundColor": "#2b4b6b",
  4. "navigationBarTitleText": "本地生活",
  5. "navigationBarTextStyle":"white"
  6. },

③配置tabBar效果

  1. "tabBar": {
  2. "list": [
  3. {
  4. "pagePath": "pages/home/home",
  5. "text": "首页",
  6. "iconPath": "./images/home.png",
  7. "selectedIconPath": "./images/home-active.png"
  8. },
  9. {
  10. "pagePath": "pages/message/message",
  11. "text": "消息",
  12. "iconPath": "./images/message.png",
  13. "selectedIconPath": "./images/message-active.png"
  14. },
  15. {
  16. "pagePath": "pages/contact/contact",
  17. "text": "联系我们",
  18. "iconPath": "./images/联系我们.png",
  19. "selectedIconPath": "./images/联系我们 (1).png"
  20. }
  21. ]
  22. },

④实现轮播图效果

2.接口地址

①获取轮播图数据列表的接口

  • [GET]http://www.escook.cn/slides 
  1. data: {
  2. //存放轮播图数据的列表
  3. swipeiList:[]
  4. },
  5. /**
  6. * 生命周期函数--监听页面加载
  7. */
  8. onLoad(options) {
  9. this.getSwiperList()
  10. },
  11. getSwiperList(){
  12. wx.request({
  13. url:'https://www.escook.cn/slides',
  14. method:'GET',
  15. success:(res)=>{
  16. this.setData({
  17. swipeiList:res.data
  18. })
  19. }
  20. })
  21. },

④实现轮播图

  1. <swiper indicator-dots circular>
  2. <swiper-item wx:for="{{swiperList}}" wx:key="id">
  3. <image src="{{item.image}}"></image>
  4. </swiper-item>
  5. </swiper>
  1. swiper{
  2. height: 350rpx;
  3. }
  4. swiper image{
  5. width: 100%;
  6. height: 100%;
  7. }

⑤实现九宫格效果

 

  1. onLoad(options) {
  2. this.getSwiperList()
  3. this.getGridList()
  4. },
  5. getGridList(){
  6. wx.request({
  7. url:'https://www.escook.cn/categories',
  8. method:'GET',
  9. success:(res)=>{
  10. this.setData({
  11. gridList:res.data
  12. })
  13. }
  14. })
  15. }
  1. .grid-list{
  2. display: flex;
  3. flex-wrap: wrap;
  4. border-left: 1rpx solid #efefef;
  5. border-top: 1rpx solid #efefef;
  6. }
  7. .grid-item{
  8. width: 33.33%;
  9. height: 200rpx;
  10. display: flex;
  11. flex-direction: column;
  12. align-items: center;
  13. justify-content: center;
  14. border-right: 1rpx solid #efefef;
  15. border-bottom: 1rpx solid #efefef;
  16. box-sizing: border-box;
  17. }
  18. .grid-item image{
  19. width: 60rpx;
  20. height: 60rpx;
  21. }
  22. .grid-item text{
  23. font-size: 24rpx;
  24. margin-top: 10rpx;
  25. }

⑥实现图片布局

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/775208
推荐阅读
相关标签
  

闽ICP备14008679号