首页 > 小程序教程 > 微信小程序双图显示最佳旅行城市列表样式制作设计教程

微信小程序双图显示最佳旅行城市列表样式制作设计教程

上一篇 下一篇
本文给大家带来的是微信小程序双图显示最佳旅行城市列表样式制作设计教程,制作好以后效果图如下:
一、wxml页面代码如下:
<view class="destination">
  <block wx:for="{{ elements }}" wx:for-item="e" wx:key="e.index">
    <view class="title">{{ e.title }}</view>
    <view class="list">
      <view class="poi" data-type="{{ poi.type }}" data-id="{{ poi.id }}" data-name="{{ poi.name }}" bindtap="viewPOI" wx:for="{{ e.data }}" wx:for-item="poi" wx:key="poi.id">
        <image src="{{ poi.cover_s }}"></image>
        <view class="mask"></view>
        <view class="name">{{ poi.name }}</view>
      </view>
    </view>
  </block>
</view>
 
二、wxss样式文件代码如下:
page{
  background-color: #f6f6f6;
}
.title{
  color: #5c5c5c;
  font-size: 30rpx;
  margin: 20rpx;
}
.list{
  display:flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;
  align-content: flex-start;
  align-items: center;
  padding: 0 20rpx;
  margin-bottom: 50rpx;
}
.poi{
  position: relative;
  margin-bottom: 12rpx;
}
.poi image{
  width: 349rpx;
  height: 349rpx;
  border-radius: 8rpx;
  vertical-align: bottom;
}
.poi .mask{
  width: 100%;
  height: 80rpx;
  position: absolute;
  bottom: 0;
  left: 0;
  background-image: linear-gradient(to top, rgba(0,0,0,.8), rgba(0,0,0,0));
  border-bottom-left-radius: 8rpx;
  border-bottom-right-radius: 8rpx;
}
.poi .name{
  position: absolute;
  left: 28rpx;
  bottom: 24rpx;
  color: #fff;
  font-size: 40rpx;
  font-weight: bold;
}
三、js页面代码如下:
const api = require('../../utils/api.js');

const App = getApp();
Page({
  data: {
    elements: [],
    windowWidth: App.systemInfo.windowWidth,
  },
  onReady() {
  },
  onLoad() {
    const self = this;
    wx.showToast({
      title: '正在加载',
      icon: 'loading',
      duration: 10000,
    });
    api.getExplorePlaceList({
      success: (res) => {
        const dest = res.data;
        self.setData({
          elements: dest.elements,
        });
        wx.hideToast();
      },
    });
  },
  viewPOI(e) {
    const data = e.currentTarget.dataset;
    wx.navigateTo({
      url: `../destination/destination?type=${data.type}&id=${data.id}&name=${data.name}`,
    });
  },
});

模板简介:该模板名称为【微信小程序双图显示最佳旅行城市列表样式制作设计教程】,大小是,文档格式为.,推荐使用打开,作品中的图片,文字等数据均可修改,图片请在作品中选中图片替换即可,文字修改直接点击文字修改即可,您也可以新增或修改作品中的内容,该模板来自用户分享,如有侵权行为请联系网站客服处理。欢迎来懒人模板【小程序教程】栏目查找您需要的精美模板。

相关搜索
  • 下载密码 lanrenmb
  • 下载次数 17,574次
  • 使用软件
  • 文件格式
  • 文件大小
  • 上传时间 06-21
  • 作者 网友投稿
  • 肖像权 人物画像及字体仅供参考
栏目分类 更多 >
热门推荐 更多 >
微信公众平台 自适应 微信文章 企业网站 微信图片 html5 微信模板 微信素材 响应式 单页式简历模板
您可能会喜欢的其他模板