微信小程序最近三个月自定义选择器

刚接到产品需求,看了原型图,按照以往项目经验,对项目进行开发排期,开发进度一切都很和谐,直到开发到‘年月日至年月日’自定义选择器,碰到了拦路虎,根据微信开发文档api耗费了大量精力,完善年月日自定义选择器,每天加班到深夜,一言难尽,现从项目中单独分离出自定义年月日。日期2022年7月1日,自定义选择器展示最近三个月。

 

  <view class="container">

    <view class="page-body">

      <picker-view indicator-style="height: 50px;" style="width: 686rpx; height: 300px;margin: 0 auto;" value="{{value}}" bindchange="bindChange">

        <picker-view-column>

          <view wx:for="{{years}}" wx:key="{{years}}"  class="{{item==year?'selected-datecolor':''}}" style="--mainColor--: {{ mainColor }};line-height: 50px; text-align: center;">{{item}}</view>

        </picker-view-column>

        <picker-view-column>

          <view wx:for="{{months}}" wx:key="{{months}}"  class="{{item==month?'selected-datecolor':''}}"   style="--mainColor--: {{ mainColor }};line-height: 50px; text-align: center;">{{item}}</view>

        </picker-view-column>

        <picker-view-column>

          <view wx:for="{{days}}" wx:key="{{days}}"  class="{{item==day?'selected-datecolor':''}}" style="--mainColor--: {{ mainColor }};line-height: 50px; text-align: center;">{{item}}</view>

        </picker-view-column>

        <picker-view-column>

          <view  style="line-height: 50px; text-align: center;">至</view>

        </picker-view-column>        

        <picker-view-column>

          <view wx:for="{{yearsright}}" wx:key="{{yearsright}}"  class="{{item==yearright?'selected-datecolor':''}}" style="--mainColor--: {{ mainColor }};line-height: 50px; text-align: center;">{{item}}</view>

        </picker-view-column>

        <picker-view-column>

          <view wx:for="{{monthsright}}" wx:key="{{monthsright}}"  class="{{item==monthright?'selected-datecolor':''}}" style="--mainColor--: {{ mainColor }};line-height: 50px; text-align: center;">{{item}}</view>

        </picker-view-column>

        <picker-view-column>

          <view wx:for="{{daysright}}" wx:key="{{daysright}}"  class="{{item==dayright?'selected-datecolor':''}}" style="--mainColor--: {{ mainColor }};line-height: 50px; text-align: center;">{{item}}</view>

        </picker-view-column>        

      </picker-view>

    </view>

  </view>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

OTT-OTT

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值