2.0.0 • Published 4 years ago

ele-calendar v2.0.0

Weekly downloads
138
License
MIT
Repository
-
Last release
4 years ago

一个vue calendar的npm组件

说明:

1.基于element-ui开发的vue日历组件。

npm.io

#####更新: 1.增加日期多选 :selectionMode="'dates'",事件select返回选择日期及节点 2.增加语言切换 :lang="'en'" 3.抽离css方便自定义样式 import 'ele-calendar/dist/vue-calendar.css' //引入css 注释:需要配置了jsx依赖

使用方法:

1.下载npm包:

#####你的VUE项目的根目录底下运行:

    npm install ele-calendar

2.引入本npm包并注册为vue的组件:

例如:在需要使用的vue页面中:

	<template>
	<!-- 里面写eleCalendar组件-->
        <ele-calendar
              :render-content="renderContent"
              :data="datedef"
              :prop="prop"
        ></ele-calendar>
</template>

<script>
import eleCalendar from 'ele-calendar'
import 'ele-calendar/dist/vue-calendar.css' //引入css
export default {
    data(){
    	return{
    		datedef:[
                {"date":"2018-06-30","content":null,"cid":null},
                {"date":"2018-06-26","content":null,"cid":null},
            ],
            prop:'date' //对应日期字段名
    	}
    },
    components: {
        eleCalendar
    },
    methods: {
      renderContent(h,parmas) {
        const loop = data =>{
          return (
            data.defvalue.value ? (<div><div>{data.defvalue.text}</div> 
            <span  >备选项</span>
            </div>) : <div>{data.defvalue.text}</div>
          )
       }
       return (
        <div  style="min-height:60px;">
         {loop(parmas)}
        </div>
        );
     },
   }
}
</script>
3.通过render-content的渲染Function 自定义日历显示内容
> 例如:
``` html
    renderContent(h,parmas) {  //设置lunarcalendar=true,parmas返回值包含农历
                const loop = data =>{
                  return (
                    data.defvalue.value ? (<div><div>{data.defvalue.text}</div> 
                    <span  >备选项</span>
                    </div>) : <div>{data.defvalue.text}</div>
                  )
               }
               return (
                <div  style="min-height:60px;">
                 {loop(parmas)}
                </div>
                );
             },
       parmas返回当前日期和传入data对应内容

Calendar Attributes

参数说明类型可选值默认值
data显示的数据array
prop对应日期字段名string
lang语言切换stringenzh-CN
selectionMode日历模式stringdatesday
highlight是否要高亮对应日期booleanfalse
currentmonth高亮选中日期booleanfalse
disabledDate设置禁用状态,参数为当前日期,要求返回 BooleanFunction
border是否带有边框booleanfalse
lunarcalendar是否需要农历booleanfalse
defaultValue默认展示某月Date-
render-content内容区的渲染 FunctionFunction(h, parmas)

Calendar Events

事件名说明参数
date-change切换日历年、月data
select选择日期的数组及节点val,selectDom
pick点击日历返回当前点击时间data、event、row、dome
2.0.0

4 years ago

1.2.0

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.0

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago