仿塞尔达攻略助手首页

海轰Pro

共 7570字,需浏览 16分钟

 · 2021-09-01

效果展示

原效果图


复现效果图


Demo代码

js

Page({

  /**
   * 页面的初始数据
   */

  data: {
    data_1: [{
        image_url'https://wx1.sinaimg.cn/mw2000/008cmE87gy1gtm1kc83e1j308c08c763.jpg',
        title'料理'
      },
      {
        image_url'https://wx1.sinaimg.cn/mw2000/008cmE87gy1gtm1kc83e1j308c08c763.jpg',
        title'Amiibo'
      },
      {
        image_url'https://wx1.sinaimg.cn/mw2000/008cmE87gy1gtm1kc83e1j308c08c763.jpg',
        title'素材'
      },
      {
        image_url'https://wx1.sinaimg.cn/mw2000/008cmE87gy1gtm1kc83e1j308c08c763.jpg',
        title'素材收集'
      },
      {
        image_url'https://wx1.sinaimg.cn/mw2000/008cmE87gy1gtm1kc83e1j308c08c763.jpg',
        title'武器'
      },
      {
        image_url'https://wx1.sinaimg.cn/mw2000/008cmE87gy1gtm1kc83e1j308c08c763.jpg',
        title'防具'
      },
      {
        image_url'https://wx1.sinaimg.cn/mw2000/008cmE87gy1gtm1kc83e1j308c08c763.jpg',
        title'马具'
      },
      {
        image_url'https://wx1.sinaimg.cn/mw2000/008cmE87gy1gtm1kc83e1j308c08c763.jpg',
        title'技巧与误区'
      },
      {
        image_url'https://wx1.sinaimg.cn/mw2000/008cmE87gy1gtm1kc83e1j308c08c763.jpg',
        title'旧版数据'
      }
    ],
    data_2: [{
        title"工具",
        func_name"食谱快速检索器",
        image_url"https://wx1.sinaimg.cn/mw2000/008cmE87gy1gtm1me6phaj30wu0d6wn7.jpg",
      },
      {
        title"Switch",
        func_name"Switch游戏攻略助手",
        image_url"https://wx1.sinaimg.cn/mw2000/008cmE87gy1gtm1me6phaj30wu0d6wn7.jpg",
      }
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */

  onLoadfunction (options{

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */

  onReadyfunction ({

  },

  /**
   * 生命周期函数--监听页面显示
   */

  onShowfunction ({

  },

  /**
   * 生命周期函数--监听页面隐藏
   */

  onHidefunction ({

  },

  /**
   * 生命周期函数--监听页面卸载
   */

  onUnloadfunction ({

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */

  onPullDownRefreshfunction ({

  },

  /**
   * 页面上拉触底事件的处理函数
   */

  onReachBottomfunction ({

  },

  /**
   * 用户点击右上角分享
   */

  onShareAppMessagefunction ({

  }
})

wxml

<view class="box1">
  <view class="title">全部</view>
  <view class="items">
    <view class="item" wx:for="{{data_1}}" wx:key="true">
      <view class="func_name">{{item.title}}</view>
      <image src="{{item.image_url}}"></image>
    </view>
  </view>
</view>
<view class="box2" wx:for="{{data_2}}">
  <view class="title">{{item.title}}</view>
  <view class="item">
    <view class="func_name">{{item.func_name}}</view>
    <image src="{{item.image_url}}"></image>
  </view>
</view>

wxss

page {
  margin0;
  background-color: red
}

.box1,
.box2 {
  position: relative;
  padding30rpx;
}

.box2 {
  margin-top: -20px;
}

.title {
  position: relative;
  width100%;
  height100rpx;
  font-size18px;
  color: black;
  font-weight500;
  line-height100rpx;
  letter-spacing1px;
  margin-left15rpx;
}

.box1 .items {
  position: relative;
  width100%;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-around;
}

.items .item {
  position: relative;
  width200rpx;
  height200rpx;
  background-color: black;
  margin10rpx;
  border-radius5px;
}

.func_name {
  width100%;
  position: absolute;
  top50%;
  left50%;
  transformtranslate(-50%, -50%);
  font-size16px;
  color: white;
  line-height200rpx;
  text-align: center;
  z-index1;
}

.items .item image {
  width100%;
  height100%;
  opacity0.7;
  /* filter: alpha(opacity=90); */
  border-radius5px;
}

.box2 .item {
  position: relative;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-around;
  background#000;
  border-radius5px;
  margin10rpx;
}

.box2 .item image {
  width100%;
  height240rpx;
  border-radius5px;
  opacity0.8;
}

结语

注:测试图片来源网络,侵删

创作不易

如果您觉得写的不错的话

「点赞+在看+收藏」 ❤️


浏览 24
点赞
评论
收藏
分享

手机扫一扫分享

举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

举报