Coder Social home page Coder Social logo

haoshenpei / vue-component-calendar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zen-li/vue-component-calendar

0.0 1.0 0.0 732 KB

Home Page: https://www.npmjs.com/package/vue-component-datepicker

JavaScript 62.65% HTML 6.70% Vue 16.80% CSS 13.85%

vue-component-calendar's Introduction

vue-component-calendar

Dependencies Dev Dependencies

Example using vue-loader with Webpack.

相关操作

# demo
双击打开`example/browser.html`

# serve with hot reload at localhost:8080 => 开发
npm run dev

# build for production with minification => 打包编译
npm run build

# prepub
gulp prepub

# publish
gulp publish

For detailed explanation on how things work, read the docs for vue-laoder.

rem说明:

1rem = 100px(iPhone5)
1rem = 117.18px(iPhone6)

使用方式

<body>
    <div class="content">
        <button @click.prevent="showCalendar=true">唤醒日历</button>
        <calendar
            :show-calendar.sync="showCalendar"
            max-date="4m"
            start-date="2016-01-23"
            end-date="2016-01-25"
            :is-double-check.sync=true
            :is-vication.sync=true></calendar>
    </div>
    <script type="text/javascript">
        var ef = new Vue({
            el: '.content',
            data: {
                showCalendar: false,
                result: null
            },
            components: {
                "calendar": vueComCalendar
            },
            events: {
                'vue-calendar-confirm': function(result) {
                    //do whatever you want.
                    console.log(result)
                },
                'vue-calendar-cancle': function(result) {
                    //do nothing
                }
            }
        });
    </script>
</body>

API

展示相关
  • max-date="4m" or max-date="90d"

    • 设置月份的时候,默认到最后一个月的最后一天是可选状态

    • 设置天数的时候,默认到天数的最后一天可选,之前和之后都不可选

  • :is-vication.sync=true

    • 是否显示假期及假日
操作相关
  • start-date="2016-01-23"

    • 设置日历默认选中的开始日期,此时默认是支持入住和离店 双选
    • 插件会自动滚动到开始日期
  • end-date="2016-01-25"

    • 设置日历默认选中的离店日期
    • 注意:如果设置是单选,但是设置了开始和结束时间是只选中开始时间
  • :is-double-check.sync=true

    • 日历是单选还是双选,文案不同,效果也不同
    • 如果是多选,但是只选择了一个日期,这时候点击完成会有错误提示
      { status: -1 , msg:"you need selected two dates." }
      
  • 'events' Method

    • vue-calendar-confirm
      • 点击完成时,会触发该事件,同时回传日期选中结果
    • vue-calendar-cancle
      • 点击backdrop区域的时候,会触发该事件,此时会关闭日历,但也同时回传当前的选中日期结果,但是这时候一般不会对数据做处理,当做取消操作。

##相关截图 ./screenshot/demo.png

vue-component-calendar's People

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.