0.1.3 • Published 1 year ago

china-calendar v0.1.3

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

日历组件

包含农历,24节气,节假日的日历

安装

npm install

运行

npm run serve

构建

npm run build

使用

<template>
    <china-calendar
        :mode="'year'"
        @date-click="dateClick"
        :year="year"
        @year-change="yearChange"
        :bgDate="bgDate"
        :badges="badges"
        :show-other-month-day="false"
    ></china-calendar>
</template>
<script>
export default {
    data() {
        return {
            year: "2023",
            bgDate: [
                "2023-04-29",
                "2023-04-30",
                "2023-05-01",
                "2023-05-02",
                "2023-05-02",
            ],
            badges: {
                节: {
                    arr: ["2023-05-07"],
                    color: "#3BCFB6",
                },
                补: {
                    arr: ["2023-04-23", "2023-05-06"],
                    color: "#F68300",
                },
                休: {
                    arr: [
                        "2023-04-29",
                        "2023-04-30",
                        "2023-05-01",
                        "2023-05-02",
                        "2023-05-02",
                    ],
                    color: "#2B8A05",
                },
            },
        };
    },
    methods: {
        dateClick(data) {
            console.log(data);
        },
        yearChange(year) {
             console.log(year);
        },
    },
};
</script>
预览

npm.io

Attributes

参数说明类型可选值默认值
mode日历模式stringyear / monthyear
show-tool显示上方工具栏booleantrue / falsetrue
show-calendar-mode显示年月模式切换按钮booleantrue / falsetrue
min最小渲染年number1900至21001900
max最大渲染年number1900至21002100
year渲染年srtring/number当前年
month渲染月srtring/number当前月
cell-size每一个日期表格大小string36px
show-lunar渲染农历booleantrue
show-festival渲染节日booleantrue
show-term渲染节气booleantrue
show-other-month-day是否显示其他月数据boolean-false
bg-date胶囊背景数据array--
badges带角标数据object--

Events

事件名称说明回调参数
year-change切换年
month-change切换月
date-click日期点击date对象,包含所有的属性

Methods

方法名说明参数
refresh重新渲染日历-

Slots

  name 说明  
date-cell日期表格显示内容

感谢

vue-lunar-calendar-pro calendar.js

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago