Code Monkey home page Code Monkey logo

miniprogram-datepicker's Introduction

npm Travis Status Codecov GitHub

miniprogram-datepicker

小程序日期选择器,使用小程序原生picker,支持农历。

使用此组件需要依赖小程序基础库 2.2.1 以上版本,同时依赖开发者工具的 npm 构建。具体详情可查阅官方 npm 文档

使用效果

Screenshot

使用方法

  1. 安装 datepicker
npm install --save miniprogram-datepicker
  1. 在需要使用 datepicker 的页面 page.json 中添加 datepicker 自定义组件配置
{
  "usingComponents": {
    "datepicker": "miniprogram-datepicker"
  }
}
  1. WXML 文件中引用 datepicker

datepicker 提供<slot>节点,用于承载组件引用时提供的子节点。

<datepicker value="{{solar}}" bindchange="bindSolarChange">
    <button type="default">公历</button>
</datepicker>
<datepicker value="{{lunar}}" chinese="{{true}}" bindchange="bindLunarChange">
    <button type="default" class="weui-btn">农历</button>
</datepicker>

datepicker的属性介绍如下:

属性名 类型 默认值 说明
value String '' 表示选中的日期,格式为"YYYY-MM-DD"
chinese Boolean false 是否农历
bindchange EventHandle value 改变时触发 change 事件,event.detail = {value: value}

应用案例

miniprogram-datepicker's People

Contributors

pithyone avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.