Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/472.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用“时刻”和“反应”创建日历组件_Javascript_Reactjs_Calendar_Momentjs - Fatal编程技术网

Javascript 使用“时刻”和“反应”创建日历组件

Javascript 使用“时刻”和“反应”创建日历组件,javascript,reactjs,calendar,momentjs,Javascript,Reactjs,Calendar,Momentjs,我在搜索React Calendar组件时发现了这把小提琴,但我不理解其中的部分代码,下面是链接 我不明白下面的部分 monthRange.by('days', function(moment) { var ref; if (ref = moment.week(), indexOf.call(weeks, ref) < 0) { return weeks.push(moment.week()); } }); monthRange.by('days',函数(时刻){

我在搜索React Calendar组件时发现了这把小提琴,但我不理解其中的部分代码,下面是链接

我不明白下面的部分

monthRange.by('days', function(moment) {
  var ref;
  if (ref = moment.week(), indexOf.call(weeks, ref) < 0) {
    return weeks.push(moment.week());
  }
});
monthRange.by('days',函数(时刻){
var-ref;
if(ref=moment.week(),indexOf.call(weeks,ref)<0){
返回weeks.push(moment.week());
}
});
通过使用,我已经包括了矩,矩范围,react with addon,但是上面的方法返回的是长度为0的周


当我调试时,我无法使用该方法。

您可以直接使用,我个人认为这比创建自己的方法要好得多。

如果您正在寻找现成的解决方案,请不要重新发明轮子。如果您想将日历作为学习React项目的一部分来构建,请查看以下更简单的代码