微信小程序-组件

客官°小女子只卖身不卖艺 2021-11-30 00:56 635阅读 0赞

1.轮播图

  1. <swiper indicator-dots="{
  2. {indicatorDots}}" indicator-color="{
  3. {indicatorColor}}"
  4. indicator-active-color="{
  5. {indicatorActiveColor}}" autoplay="{
  6. {autoplay}}" interval="{
  7. {interval}}"
  8. duration="{
  9. {duration}}" circular="{
  10. {circular}}">
  11. <block wx:key="item" wx:for="{
  12. {imgUrls}}">
  13. <swiper-item>
  14. <image src="{
  15. {item}}" class="slide-image" />
  16. </swiper-item>
  17. </block>
  18. </swiper>
  19. 参数:
  20. imgUrls:[],
  21. indicatorDots: true,
  22. indicatorColor: '#fff',
  23. indicatorActiveColor: '#666',
  24. autoplay: true,
  25. interval: 5000,
  26. duration: 500,
  27. circular: true,

  

2.下拉选择

  1. 1)输入框
  2. <input type='text' bindchange='changInput' placeholder='邮政编码'></input>
  3. 2)下拉选择时间
  4. <picker bindchange="changInput" mode="date" value="{
  5. {postData.mail_time}}" start="2019-06-01" end="2020-09-01">
  6. <view class="picker">
  7. {
  8. {postData.mail_time}}
  9. </view>
  10. </picker>
  11. 3)下拉选择单项,range-key只能解析data下面一层
  12. <picker bindchange="changInput" value="{
  13. {indexPerson}}" range="{
  14. {arrayPerson}}" range-key="zh_name">
  15. <view class="picker">
  16. {
  17. {arrayPerson[indexPerson]||'请选择人数'}}
  18. </view>
  19. </picker>
  20. 当输入框变化时,方法changInput就了根据传过来的id来判断处理值
  21. <script>
  22. changInput(e) {
  23. let id = e.currentTarget.dataset.id
  24. let value = e.detail.value
  25. if (id === 1) {
  26. this.setData({
  27. value: value
  28. })
  29. }
  30. }
  31. </script>

  

转载于:https://www.cnblogs.com/fm060/p/11014747.html

发表评论

表情:
评论列表 (有 0 条评论,635人围观)

还没有评论,来说两句吧...

相关阅读

    相关 程序 - 组件

    > 微信小程序为开发者提供了一系列基础组件,使开发者可以进行快速开发。同时还支持自定义组件,提升代码复用性,有助于代码维护。 一、基础组件 > 基础组件主要分为:视图容