页面

<!--index.wxml-->
<view class="page"><view class="title">首页 </view><view class="search"><input type="text" placeholder="输入你想了解的内容" /></view><!-- 轮播图 --><view class="swiper"><swiper indicator-dots="true" autoplay="true" interval="5000" duration="500" indicator-active-color="#ffca28"indicator-color="#FFFFFF"><block wx:for="{{swiper}}"><swiper-item class="swiper-item"><image src="{{item.pic}}"></image></swiper-item></block></swiper></view><!-- 改善部位 --><view class="list loc"><view class="til">改善部位</view><view class="con"><scroll-view class="scroll" scroll-x="true" enhanced="true" show-scrollbar="true"><view class="loc-item item" ><view class="locimg"><image src="/common/img/u381.png" class="img"></image></view><view class="loc-title">全身</view></view><view class="loc-item item"  ><view class="locimg"><image src="/common/img/u382.png" class="img"></image></view><view class="loc-title">腿部</view></view><view class="loc-item item" ><view class="locimg"><image src="/common/img/u383.png" class="img"></image></view><view class="loc-title">臀部</view></view><view class="loc-item item"><view class="locimg"><image src="/common/img/u383.png" class="img"></image></view><view class="loc-title">腹部</view></view></scroll-view></view></view><!-- 热门课程 --><view class="list"><view class="til">热门课程</view><view class="con"><scroll-view class="scroll" scroll-x="true" enhanced="true" show-scrollbar="true"><block wx:for="{{course}}"><view class="item hot" bindtap="info" data-id="{{item.id}}"><image src="{{item.pic}}" class="img"></image><text class="time">{{item.len_time}}</text><text class="name">{{item.name}}</text></view></block></scroll-view></view></view>
</view>

样式

/**index.wxss**/
.page{width: 90%;margin: 0 auto;
}
.title{font-weight: bold;font-size: 24px;
}
.search{height: 45px;line-height: 45px;margin: 20px 0;border: 1px solid #ccc;border-radius: 10px;background-color: #F6F6F6;
}
.search input{width: 100%;height: 100%;padding-left: 15px;
}
.swiper-item{width: 100%;height: 300px;border-radius: 20px;
}
.swiper-item image{width: 100%;height: 100%
}
.list{margin-top: 20rpx;
}
.con{height: 300rpx;display: flex;justify-content: start;
}
.scroll{white-space: nowrap;
}
.item{margin: 25rpx 20rpx;border-radius: 20rpx;display: inline-block;
}
.loc-item{width: 180rpx;height: 250rpx;
}
.locimg{width:180rpx;height: 180rpx;border-radius: 15px;
}
.img{width: 100%;height: 100%;border-radius: 15rpx;
}
.loc-title{line-height: 30px;text-align: center;
}
.hot{width: 500rpx;height: 250rpx;
}
.time{position: relative;top: -200rpx;left: -480rpx;font-size: 12px;color: white;padding: 0 5rpx;border-radius: 10rpx;background-color: #ee3237;
}
.name {position: relative;left: -580rpx;top: -20rpx;color: white;font-size: 14px;
}

效果图

// index.js
// 获取应用实例
const app = getApp()Page({data: {swiper:['/common/img/u400.png','/common/img/u401.png'],course:{},},onLoad() {this.swiper();this.course();},swiper(){wx.request({url: 'http://www.tp6.com/lx/course/swiper',dataType:'json',success:({data})=>{console.log(data);if(data.code == 200){this.setData({swiper:data.data});} }})},course(){wx.request({url: 'http://www.tp6.com/lx/course/index',dataType:'json',success:({data})=>{console.log(data);if(data.code == 200){this.setData({course:data.data});} }})},info(evt){console.log(evt);let id = evt.currentTarget.dataset.id;wx.navigateTo({url: '/pages/courseinfo/courseinfo?id='+id,})},
})

微信小程序 首页轮播图 x轴 横向滚动视图相关推荐

  1. 微信小程序实现轮播图(超简单)

    Tips:微信小程序可以在HbuilderX用HTML标签(如Ddiv.span等)写前端代码,也可以用微信小程序语法写(view.swiper标签),然后npm run dev编译后,在微信开发者工 ...

  2. php轮播怎么调整图片大小,微信小程序内轮播图怎样设置成自适应高度

    这次给大家带来微信小程序内轮播图怎样设置成自适应高度,微信小程序内轮播图怎设置成自适应高度的注意事项有哪些,下面就是实战案例,一起来看一下. 我的思路是:获取屏幕宽度,获取图片的宽高,然后等比设置当前 ...

  3. 微信小程序swiper图片尺寸_微信小程序 swiper 轮播图 高度自适应

    微信小程序 swiper 轮播图 高度自适应 发布时间:2018-07-20 15:34, 浏览次数:588 , 标签: swiper 小程序中使用swiper 组件 ,实现轮播图高度自适应效果. 先 ...

  4. 微信小程序---swiper轮播图组件

    微信小程序-swiper轮播图组件 在components中新建文件夹swiper components/swiper/swiper.wxml <!--components/swiper/swi ...

  5. 微信小程序轮播中的current_微信小程序 swiper轮播图的按钮切换

    一.前言 swiper组件自带autoplay切换,本文将会介绍如何用到左右按钮切换轮播图,以及如何解决快速点击按钮出现的bug. 核心属性 circular: 负责切换衔接的效果(否则最后一张与第一 ...

  6. 小程序轮播图_微信小程序层叠轮播图

    效果展示 Demo代码 wxml <view class="selection_cards" bindtouchstart="touchstart" bi ...

  7. 微信小程序3D轮播图实现

    好久没有写博客了,前段时间换了家公司,做了两个多星期,完成了一款app的开发, 公司没有app的需求了,我们几个移动端Android和IOS都转岗开发微信小程序,由于刚接触小程序不到两周,技术还是基于 ...

  8. 微信小程序之轮播图swiper组件自定义指示点样式

    微信小程序 - swiper组件 定义一个轮播图 swiper 组件: // swiper.wxml <swiper indicator-dots="true">< ...

  9. 【自定义轮播图】微信小程序自定义轮播图无缝滚动

    先试试效果,可以通过设置参数调整样式 微信小程序中的轮播图可以直接使用swiper组件,如下: <swiper indicator-dots="{{indicatorDots}}&qu ...

最新文章

  1. 把mysql安装到服务器端_MySQL服务器端安装
  2. 五种常见的PHP设计模式
  3. js 获取字符串中的中文
  4. C语言项目--教师信息/学生成绩管理系统
  5. python语言命令大全-Python常用命令最全合集
  6. 可以看到对方是否打开_打开手机实景地图,连你家门口都可以清晰看到,方便又好用...
  7. 含k个3的数(信息学奥赛一本通-T1090)
  8. vue中标签自定义属性的使用
  9. php5 mysql怎样下载,PHP5操作MySQL数据库(5)
  10. 句子表示学习前沿技术分享
  11. LeetCode 973. K Closest Points to Origin
  12. 如何巧妙使用Camtasia库中的素材?
  13. 使用ildasm获取源代码_有什么比ILDasm好? ILSpy和dnSpy是反编译.NET代码的工具
  14. Alex Fung魔方解法学习记
  15. BIM技术之Dynamo图元编程:柱、球面坐标系节点绘制螺旋线
  16. excel怎么设置密码?加密文件这么做!
  17. JZOJ 6310.glo【LIS】【线段树】
  18. unity 神笔画画
  19. java 语音包_有人开发了马保国语音包
  20. 《A CMOS Time-to-Digital Converter With BetterThan 10ps Single-Shot Precision》论文阅读

热门文章

  1. 唯品会java hr面_唯品会秋招HR面试问题大曝光?(一面)
  2. python判断神奇九转-akshare
  3. 未知的漏洞才是最可怕的存在之漏洞零日
  4. Microsoft Exchange Server中的四个零日漏洞已被链接使用在野袭击
  5. 【Day1.2】金银滩大草原
  6. 【Codeforces Round #525(Div. 2)】Ehab and another another xor problem(思维+异或)
  7. Kendo UI组件Kendo UI Support for Vue发布R3 2018|附下载
  8. codewar 代码练习1——8级晋升7级
  9. 2015年1月6日回顾
  10. 如何选择安全可靠的远程控制软件?TeamViewer做出良好示范