0.1.1 • Published 2 years ago

ms-vue-calendar v0.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

ms-vue-calendar

A Vue.js project

news

  • 最新稳定版 0.99(支持 mongolian/tibetan/english/uighur)
  • 按日选择为第一选择
  • 增加yyyy/mm/dd

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

For detailed explanation on how things work, consult the docs for vue-loader.

Installation

npm install ms-vue-calendar

Use

<template>
    <div id="app">
        <div class="example">
            <button @click="showPicker=true">点击弹出</button>
        </div>
        <!-- 通话详单样式支持按月、按日范围选择(需选择两次) -->
        <ms-vue-calendar
            ref="mscalendar"
            :show-picker="showPicker"
            :show-confirm="true"
            date-type="range"
            :lang="langString"
            :server-date="serverDate"
            date-format="/"
            :show-month-tab="true"
            :month-range="6"
            :active="0"
            :within-month="true"
            theme-color="#E60027"
            @confirm="confirm"
            @close="showPicker = false"
        ></ms-vue-calendar>

        <!-- 上网记录 -->
        <!-- <ms-vue-calendar
            ref="mscalendar"
            :show-picker="showPicker"
            :show-confirm="true"
            date-type="range"
            :lang="langString"
            :server-date="serverDate"
            date-format="/"
            :show-month-tab="true"
            :start-date="'2021/03/02'"
            :active="0"
            :within-month="true"
            theme-color="#E60027"
            @confirm="confirm"
            @close="showPicker = false"
        ></ms-vue-calendar> -->

        <!-- 单日立即选择 -->
        <!-- <ms-vue-calendar
            ref="mscalendar"
            :show-picker="showPicker"
            :show-confirm="false"
            date-type="single"
            :lang="langString"
            :server-date="serverDate"
            date-format="/"
            :show-month-tab="false"
            :months-range="6"
            :within-month="false"
            theme-color="#E60027"
            @confirm="confirm"
            @close="showPicker = false"
        ></ms-vue-calendar> -->

        <!-- 最多七天无标题tab -->
        <!-- <ms-vue-calendar
            ref="mscalendar"
            :show-picker="showPicker"
            :show-confirm="false"
            date-type="range"
            :show-tab="false"
            :lang="langString"
            :server-date="serverDate"
            date-format="/"
            :show-month-tab="false"
            :months-range="6"
            :max-range="7"
            range-prompt-text="最多查询7天且不能跨月选择"
            :selected-date="selectedDate"
            :within-month="true"
            theme-color="#E60027"
            @confirm="confirm"
            @close="showPicker = false"
        ></ms-vue-calendar> -->
    </div>
</template>
import msVueCalendar from 'ms-vue-calendar';
Vue.use(msVueCalendar);

components: {
    msVueCalendar
}

data () {
  return {
        showPicker: false,
        serverDate: "",
        langString: "",
        selectedDate: [new Date('2022/3/24'),new Date('2022/3/30')]
  }
},
created() {
    this.serverDate = new Date().toLocaleDateString(); //'2021/2/8'
    this.langString = ""; //"english"; //"uighur"; //"mongolian"; //
},
methods: {
    confirm(dates) {
        console.log("selected", dates);
    },
},

Result Example

  • month: 按月选择

    {
        dd: "01"
        formattedMonth: "2022/02"
        mm: "02"
        month: Tue Feb 01 2022 00:00:00 GMT+0800 (中国标准时间)
        monthymd: "202202"
        type: "month"
        yyyy: "2022"
    }
  • range:按日期范围选择(同一天时yyyy/mm/dd取的是startDay)

    {
        dd: "31"
        endDay: Fri Apr 01 2022 00:00:00 GMT+0800 (中国标准时间)
        endDayymd: "20220401"
        formattedEndDay: "2022/04/01"
        formattedStartDay: "2022/03/31"
        mm: "03"
        startDay: Thu Mar 31 2022 00:00:00 GMT+0800 (中国标准时间)
        startDayymd: "20220331"
        type: "range"
        yyyy: "2022"
    }
  • single:单日立即选择

    {
        day: Fri Apr 01 2022 00:00:00 GMT+0800 (中国标准时间)
        dayymd: "20220401"
        dd: "01"
        formattedDay: "2022/04/01"
        mm: "04"
        type: "single"
        yyyy: "2022"
    }

Props

propdescriptontypedefault
show-picker显示日历Booleanfalse
date-type日历规则String'range'可选('single'为单日选择)
show-confirm显示底部按钮Booleantrue
theme-color主题颜色String"#e60027"
show-month-tab显示按月选择Booleantrue
show-day-tab显示按日选择Booleantrue
server-date设定当前时间Stringnew Date().toDateString()
months-range日历范围月数Number6
within-month是否可以跨月选择Booleanfalse
max-range跨日选择的天数NumberInfinity
show-tab是否显示标题标签Booleantrue 可选(false)
selected-date默认已选日期Objectnull 可选 new Date('2021/9/24')或new Date('2021/9/24'),new Date('2021/9/30')
lang多语言String"chinese"可选("english"/"uighur"/"kaza"/"tibetan"/"mongolian")
start-date最小日期范围Stringnull 格式"2021/10/17"
end-date结束日期范围Stringnull 格式"2021/10/17"

Events

eventdescripton
confirm选择日期事件
close关闭日历事件
0.0.99

2 years ago

0.1.0

2 years ago

0.1.1

2 years ago

0.0.97

2 years ago

0.0.98

2 years ago

0.0.95

2 years ago

0.0.96

2 years ago

0.0.93

2 years ago

0.0.94

2 years ago

0.0.92

3 years ago

0.0.91

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago