Comments (11)
方式一:可以在onChangeMonthBefore这个回调里面使用this.set('tagDates', tagDates)来设置新的标记,但是如果你是要根据下一个月的年月日数据才能确定tagDates的场景下这种方式不适用,因为onChangeMonthBefore回调传回来的是没切换月之前的年月日
方式二:初始化日历时不要传入tagDates,在onChangeMonth回调里面调用this.takeTages(tagDates)来打标记
方式二更适合各种场景
from calendar.
更正:this.takeTages 应该改为 this.takeTags
from calendar.
谢谢啦
from calendar.
您好,遇到一个问题,在日历中填充标记时,本来应该标记下个月的5号,但是后台送过来的格式是[18,19,5],标记在日历中却把当月的5号标记上了,这个要怎么解决
from calendar.
这种情况暂时没办法解决,目前只支持当前月份的标记,需要标记下一个月的日期得改一下源码
from calendar.
这个改起来困难吗?能不能提供一下思路要怎么改,主要改哪个地方
from calendar.
改这个方法,现在只是找'.date'当前月的,可以判断一下你的标记是上一月或下一月,找'.pre'或'.next'的来添加标记
from calendar.
判断标记是上个月还是下个月还是当前月,现在这个tags标记数组[18,19,5]可以改成[{"date":18,"bj":"now"},{"date":19,"bj":"now"},{"date":5,"bj":"next"}]吗?还是标记数组格式不变,js通过其他方法也能判断出是上个月还是下个月?
from calendar.
这个得你自己去判断了,提供个思路,遍历标记数据,直到一个数字比上一个小,那么就可以认定,从这个数字开始就是下一个月的日期
from calendar.
我也想过这个办法,但是不行,如果后台送过来的是【1,2】,这样便无法判断出是当月的1号和2号还是下个月的1号和2号。我现在想把标记数组的格式变成上面的二维数组的样子,但不知道对源码的哪些地方有影响?
from calendar.
你看一下源码,不复杂的,takeTags这个方法就是找到对应日期的dom节点添加一个class,只是现在没有处理上一个月和下一个月的日期,当前月的日期dom节点class是.date,上一个月和下一月的分别是.pre, .next,你区分一下处理就行了
from calendar.
Related Issues (12)
- 组件滑动demo更新 HOT 1
- 有时候会出现跳月 HOT 1
- 怎么让 PC 也支持点击事件
- 点击当前月份的显示的前几天 HOT 3
- 是否可以支持左右手势操作 HOT 5
- 这个日历是否发布过文章,想再看看 HOT 1
- 关于功能扩展 HOT 1
- 折叠切换
- 日历展开切换月份 HOT 1
- 大佬,请问是否有发表一篇日历思路的帖子。之前在公众号看过,但忘记是在哪的了
- 左右滑动切换月份
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from calendar.