import React, { Component } from 'react'; import {observer} from 'mobx-react'; import { WeaDatePicker, WeaCheckbox, WeaLocaleProvider } from 'ecCom'; import moment from 'moment'; const getLabel = WeaLocaleProvider.getLabel; const DateTabItem = props => { const {store, tabInfo, idx} = props; const {selectedDateTabKey, getData} = store; const onClickHandle = () => { store.selectedDateTabKey = tabInfo.key; const current = new moment(); switch(tabInfo.key){ case '0': store.selectedDate = current.format('YYYY-MM-DD'); break; case '1': store.selectedDate = current.subtract(1, 'days').format('YYYY-MM-DD'); break; case '2': store.selectedDate = current.format('YYYY-MM'); break; } getData(); } return (
{tabInfo.title}
) } @observer export default class SearchBar extends Component{ onTabChangeHandle = key => { } onCheckBoxChangeHandle = v => { const {store} = this.props; store.showSignInfo = (v == 1); } onRefreshHandle = () => this.props.store.getData(true); render(){ const {store} = this.props; const {dateTabDatas, selectedDateTabKey, showSignInfo, datePickerProps} = store; return (
{ dateTabDatas && dateTabDatas.map((t, i) => { const comProps = {tabInfo: t, idx: i}; return ( ) }) }
) } }