Coder Social home page Coder Social logo

Comments (11)

DMQ avatar DMQ commented on September 24, 2024

方式一:可以在onChangeMonthBefore这个回调里面使用this.set('tagDates', tagDates)来设置新的标记,但是如果你是要根据下一个月的年月日数据才能确定tagDates的场景下这种方式不适用,因为onChangeMonthBefore回调传回来的是没切换月之前的年月日
方式二:初始化日历时不要传入tagDates,在onChangeMonth回调里面调用this.takeTages(tagDates)来打标记
方式二更适合各种场景

from calendar.

DMQ avatar DMQ commented on September 24, 2024

更正:this.takeTages 应该改为 this.takeTags

from calendar.

shihang1228 avatar shihang1228 commented on September 24, 2024

谢谢啦

from calendar.

shihang1228 avatar shihang1228 commented on September 24, 2024

您好,遇到一个问题,在日历中填充标记时,本来应该标记下个月的5号,但是后台送过来的格式是[18,19,5],标记在日历中却把当月的5号标记上了,这个要怎么解决

_20180116165750

from calendar.

DMQ avatar DMQ commented on September 24, 2024

这种情况暂时没办法解决,目前只支持当前月份的标记,需要标记下一个月的日期得改一下源码

from calendar.

shihang1228 avatar shihang1228 commented on September 24, 2024

这个改起来困难吗?能不能提供一下思路要怎么改,主要改哪个地方

from calendar.

DMQ avatar DMQ commented on September 24, 2024

改这个方法,现在只是找'.date'当前月的,可以判断一下你的标记是上一月或下一月,找'.pre'或'.next'的来添加标记
image

from calendar.

shihang1228 avatar shihang1228 commented on September 24, 2024

判断标记是上个月还是下个月还是当前月,现在这个tags标记数组[18,19,5]可以改成[{"date":18,"bj":"now"},{"date":19,"bj":"now"},{"date":5,"bj":"next"}]吗?还是标记数组格式不变,js通过其他方法也能判断出是上个月还是下个月?

from calendar.

DMQ avatar DMQ commented on September 24, 2024

这个得你自己去判断了,提供个思路,遍历标记数据,直到一个数字比上一个小,那么就可以认定,从这个数字开始就是下一个月的日期

from calendar.

shihang1228 avatar shihang1228 commented on September 24, 2024

我也想过这个办法,但是不行,如果后台送过来的是【1,2】,这样便无法判断出是当月的1号和2号还是下个月的1号和2号。我现在想把标记数组的格式变成上面的二维数组的样子,但不知道对源码的哪些地方有影响?

from calendar.

DMQ avatar DMQ commented on September 24, 2024

你看一下源码,不复杂的,takeTags这个方法就是找到对应日期的dom节点添加一个class,只是现在没有处理上一个月和下一个月的日期,当前月的日期dom节点class是.date,上一个月和下一月的分别是.pre, .next,你区分一下处理就行了

from calendar.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.