マークのレイヤを追加するカレンダーのAnt deginの日付に現在の月

コンポーネントが'REACT' {}からインポートし、反応; 
インポートカレンダー{、}タグ"antd"から、
インポート'瞬間'瞬間から、
インポート'モーメント/ロケール/ ZH-CN';
インポート」./attendanceInfo.css';
モーメント.LOCALE( 'ZH-CN');
//テストケースステータスデータを受信
// CONST this.state.attendanceDate = [
// {
// DATE: '2019年8月1日'、
//状態:0、/ /正常グリーン
//}
// {
// DATE: '2019年8月2日'、
//状態:. 1、後期//イエロー
//}
// {
// DATE: '2019年8月3日' 、
//状態:2、欠勤//赤
//}
// {
// DATE: '2019年8月4日'、
//状態:. 3、//ブルーを残し
、} //
{//
//日: '2019年8月5日'、
//状態:3、//休假ブルー
} //
// {
//日: '2019年8月6日'、
//状態:3、//休假ブルー
//}
// {
//日: '2019年8月7日'、
//状態:3、//休假ブルー
} //
//]。
// CONST {this.state.attendanceDate} = this.props。
// constのreciveDate = AttendanceInfo.this.state.attendanceDate。
//関数onPanelChange(値、モード){
//はconsole.log( "値年:" + value.year())。
//はconsole.log(のparseInt(value.month())+ 1)。
//はconsole.log( "値日:" + value.date());
//はconsole.log( "モード:" +モード);
console.log //(モーメント(値).format( 'MM-DD-YYYYのHH:MM:SS')+ "&&&" +モード)
にconsole.log(reciveDate)//
//を}


//月レンダリングしますセルの内容
// getMonthData関数(値){
//(value.month()=== 8){IF
1394返す; //
//}
//}
コンテンツのレンダリング方法//月
//関数monthCellRender(値){
// CONST NUM = getMonthData(値);
// NUMを(戻す
// <クラス名= DIV "ノートヶ月">
// <sectionTop> {NUM} </ sectionTop>
// <スパン>バックログ番号</ span>を
// </ div>
//):NULL;
//}
エクスポートデフォルトクラスAttendanceInfoは、コンポーネント{延び
{コンストラクタ(小道具)
スーパー(小道具);
this.state = {
attendanceDate:[]
}
}

getListData(値){
たlistDataを聞かせ= [];
のため(LET I = 0; I <this.state.attendanceDate.length; Iは++){
LETのDATE this.state.attendanceDate = [I] .date.split( " - ");
LET handleDate日= [2];
処理// 01-09日の日付
(handleDate <10){IF
handleDate = DATE [2 ] .substring(1);
//はconsole.log(+ handleDate "日付として扱わ");
}
IF(value.date()のtoString()=== handleDate){
//はconsole.log(「分析日付の成功「);
//はconsole.log( "ステータスコード" + this.state.attendanceDate [I] .STATE);
// 2つのステータスコードの日付処理のため
せhandleState = this.state.attendanceDate [I] .state.split (」 ');
にconsole.log(handleState);
のため(LET J = 0; J <handleState.length; J ++){
スイッチ(handleState [J]){
ケース'0801':
listData.push({色:'グリーン'コンテンツ:'正常'});
BREAK;
ケース' 0802 ':
listData.push({色:'イエロー'コンテンツ:'後期「});
BREAK。
ケース'0803':
listData.push({色: '赤'、コンテンツ'旷工'})。
ブレーク;
ケース'0804':
listData.push({色: '青'、コンテンツ'休假'})。
ブレーク;
デフォルト:
}
}


}
}
listDataプロパティを返します。
}

dateCellRender(値){
CONSTたlistData = this.getListData(値)。
//にconsole.log(たlistData)。
リターン(
<ULクラス名= "イベント">
{listData.map(項目=>

<Item.colorタグカラー{} => {item.content} </タグ>
</ LI>
))}
</ UL>
);
}

componentDidMount(){
this.setState({
attendanceDate:this.props.attendanceDate、
});
はconsole.log( "部品の実装");
はconsole.log(this.props.attendanceDate);
}
レンダリング(){
リターン(
<クラス名=カレンダー"attendanceCal" dateCellRender this.dateCellRender.bind = {(この)} />

}
}


//注:this.props.attendanceDate親コンポーネントは、データJSON上を通過します

おすすめ

転載: www.cnblogs.com/Jayeblog/p/11428824.html