This repository has been archived by the owner on Mar 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 201
日历事件用法
Coding edited this page May 11, 2018
·
4 revisions
(1)wxml文件
<calendar bindnextMonth="next" />
(2)js文件
Page({
next: function (event) {
console.log(event.detail);
}
})
假设当前是2018年4月,点击下个月按钮,在控制台会打印出:
{
currentMonth:5,
currentYear:2018,
prevMonth:4
prevYear:2018
}
(1)wxml文件
<calendar bindprevMonth="prev" />
(2)js文件
Page({
prev: function (event) {
console.log(event.detail);
}
})
假设当前是2018年4月,点击上个月按钮,在控制台会打印出:
{
currentMonth:3,
currentYear:2018,
prevMonth:4
prevYear:2018
}
(1)wxml文件
<calendar binddateChange="dateChange" />
(2)js文件
Page({
dateChange: function (event) {
console.log(event.detail);
}
})
假设当前是2018年4月,选择了2015年7月,在控制台会打印出:
{
currentMonth:7,
currentYear:2015,
prevMonth:4
prevYear:2018
}
(1)wxml文件
<calendar binddayClick="dayClick" />
(2)js文件
Page({
dayClick: function (event) {
console.log(event.detail);
}
})
假设当前是2018年4月,点击了4月4日这一天,在控制台会打印出:
{
background:"transparent"
color:""#4a4f74""
day:4
lunarDay:"十九"
lunarMonth:"二月"
month:4
year:2018
}