zoukankan      html  css  js  c++  java
  • 微信小程序开发之日期组件

    一: wxml:

        <view class="navbarlift" style="background:#ffffff;padding:20rpx">
          <picker mode="date" value="{{date}}" start="2010-09-01" end="2020-09-01" bindchange="bindDateChange">
            <view class="picker">
              {{date}}
              <image style="height:20rpx;20rpx" src="pic/日期.png"></image>
            </view>
          </picker>
        </view>

    wcss:

    .picker{
      float:left;
      margin-left: -10rpx;
      margin-top: -20rpx;
      margin-bottom: -20rpx;

    }

    .navbarlift
    {
      float:left;
      margin-left: 20rpx;
      margin-top: 20rpx;
      border:1px solid rgba(0, 0, 0, 0.2);
    }

    js:

      //  点击日期组件确定事件  
      bindDateChange: function (e) {
        var that = this;
        this.setData({
          date: e.detail.value,
        });}

    ui:

    二:wxml

      <view class="navbarlift" style="background:#ffffff;padding:20rpx;margin-right:20rpx;">
            <picker mode="date" value="{{date}}" start="2010-09-01" end="2020-09-01" bindchange="bindDateChange"style="margin-top:-8rpx">
              <view class="picker" style="">
              {{date}}
              <image src="../../../images/日期.png" style="40rpx;height:40rpx;float:right"></image>
              </view>
            </picker>
            
          </view>

    wcss:

    /*日期选择组件样式*/
    .picker{
      margin-left: 250rpx;
      margin-bottom: -12rpx;
      align-items: center;
    }
    .navbarlift
    {
      margin-left: 20rpx;
      margin-top: 20rpx;
      border:1px solid rgba(255, 255, 0, 0.2);
    }

    js:

      //  点击日期组件确定事件  
      bindDateChange: function (e) {
        var that = this;
        that.setData({
          date: e.detail.value,
          currentTab: 4
        });}

    UI:

  • 相关阅读:
    BOM与DOM
    CSS中的长度单位及颜色表示
    关于display:grid layout
    关于position
    简单的注册表单
    We重邮
    APP定制开发的完整流程
    国内移动广告平台的混战大盘点
    Mobile App Monetization, Analysis & Mediation – Google AdMob
    代码优化
  • 原文地址:https://www.cnblogs.com/min-min-min/p/7452842.html
Copyright © 2011-2022 走看看