问题描述
我有一个 react-big-calendar (父容器),我还有一个选择,日历的事件是根据这个选择(医生姓名)获取的,当我点击它时我有一个按钮,对话框将出现(另一个组件),在这个对话框,我有一个表单可以在选择之后添加一个事件,当我发布我的 API 时,我将它保存在本地存储中,但是在刷新页面并重新选择医生姓名后,添加的事件并没有出现在我的日历上.但我想,当我点击保存按钮时,会直接添加到日历上,并且会出现在日历上.
我的日历代码是:
import Popup from './Popup';导出默认类日历扩展组件 {构造函数(道具){超级(道具);这个.state = {事件:[],打开:假,}}componentDidMount = () =>{获取(process.env.REACT_APP_API_BACKEND_YET+'get_liste_praticien.php').then(响应 => Response.json()).then(数据 => {this.setState ({ praticiens : data })localStorage.setItem('Liste de praticiens', JSON.stringify(this.state.praticiens))})}fetchData = (nom,identifiant_user) =>{这个.setState({事件:[],evtStorage:[],上一个事件:[],evt后端:[]})获取(process.env.REACT_APP_API_BACKEND+'get_liste_planning').then(响应 => Response.json()).then(数据 => {让 evts = data.ListeResult;for (让 i = 0; i < evts.length; i++) {evts[i].start = moment(evts[i].start).toDate();evts[i].end = moment(evts[i].end).toDate();if(evts[i].typeplanning === '0') this.setState({isConges:true})this.state.events.push(evts[i])}这个.setState({evtBackend: evts,事件:evts})localStorage.setItem("Liste de Planning de " + nom, JSON.stringify(this.state.events));})const evtCached1 = JSON.parse(localStorage.getItem('Liste récente de planning de ' + nom));if(evtCached1 !== null) {for (让 j = 0; j < evtCached1.length; j++) {evtCached1[j].start = moment(evtCached1[j].start).toDate();evtCached1[j].end = moment(evtCached1[j].end).toDate();if(evtCached1[j].typeplanning === '0') this.setState({isConges:true})this.state.events.push(evtCached1[j]);}这个.setState({事件:this.state.events,});localStorage.removeItem("计划清单" + nom);}}//对于选择handlePraticienChange = id_user =>{这个.setState({openPopupAjout:是的,id_user: id_user},() =>{this.state.praticiens.map((praticien)=> {如果(this.state.id_user === praticien.id_user){this.setState ({ nom_user: praticien.nom_user})this.fetchData(praticien.nom_user, praticien.identifiant_user);}})});}//对于弹出窗口ModalAjoutb =(参考)=>{如果(参考){this.ajoutb = ref.handleAjouterb;} 别的 {this.ajoutb = null;}}使成为() {返回 (<button className="bp3-button bp3-icon-add-to-artifact .bp3-fill" tabIndex="0" onClick={() =>this.ajoutb(this.state.id_user, this.state.events)}>添加事件</button><选择 onChange={this.handlePraticienChange} 值={this.state.id_user}>{this.state.praticiens.map((praticien) =><选项键={praticien.id_user} 值={praticien.id_user}>{praticien.nom_user}</Option>)}</选择><拖放日历可选择的本地化器={本地化器}事件={this.state.events}意见={['月','周','日']}默认视图="周"文化 = 'f'/><Popup ref={this.ModalAjoutb} id_user={this.state.id_user} events={this.state.events}/></div>);}}<小时>
我的对话框代码是:
export default class Popup extends Component {构造函数(道具){超级(道具);这个.state = {事件:[],}}handleAjouterb = (id_user) =>{这个.setState({openPopupAjout:是的,id_user,}, () =>{this.fetchingPopup(this.state.id_user, this.state.identifiant_user, this.state.nom_user)});}fetchingPopup = (id_user, identifiant_user, nom_user) =>{const praticiensCached = JSON.parse(localStorage.getItem('Liste de praticiens '));for (让 j = 0; j < praticiensCached.length; j++) {if(id_user === praticiensCached[j].id_user){identifiant_user = praticiensCached[j].identifiant_user;this.setState ({ nom_user: praticiensCached[j].nom_user })}}句柄验证器 = 事件 =>{event.preventDefault();const praticiensCached = JSON.parse(localStorage.getItem('Liste de praticiens '));for (让 j = 0; j < praticiensCached.length; j++) {如果(this.state.id_user === praticiensCached[j].id_user)this.state.identifiant_user = praticiensCached[j].identifiant_user;}常量 formData = new FormData();formData.append('identifiant_user', this.state.identifiant_user);formData.append('heuredebut', this.state.tranchesC[0].startC);formData.append('heurefin', this.state.tranchesC[0].endC);formData.append('libelleconge', this.state.libelle);轴({方法:'发布',url: process.env.REACT_APP_API_BACKEND+'add_event_docteur',数据:表格数据,标题:{'内容类型':'应用程序/json','接受': '应用程序/json',}}).then(() => {fetch(process.env.REACT_APP_API_BACKEND+'get_liste_planning/start='+moment().startOf('isoweek').subtract(14,'days').toJSON()+'&end='+moment().endOf('isoweek').add(2,'months').toJSON()+'&identifiant_user='+this.state.identifiant_user).then(响应 => Response.json()).then(数据 => {让 evts = data.ListeResult;for (让 i = 0; i < evts.length; i++) {evts[i].start = moment(evts[i].start).toDate();evts[i].end = moment(evts[i].end).toDate();this.state.events.push(evts[i])}这个.setState({事件:this.state.events}, ()=>{localStorage.setItem('Liste récente de planning de ' + this.state.nom_user, JSON.stringify(this.state.events));localStorage.removeItem("计划清单" + this.state.nom_user);localStorage.setItem("计划清单" + this.state.nom_user, JSON.stringify(this.state.events));})})})}使成为() {返回 (<对话图标="应用"onClose={this.handleClose}title="博士计划组织"{...this.state}isOpen={this.state.openPopupAjout}><Input id="libelle" style={{ width: '480px' }} value={this.state.libelle} onChange={this.handleInputChange('libelle')}/><label className="pt-label .modifier"><strong>日期</strong></label><LocaleProvider 语言环境={fr_FR}><RangePicker id="date" name="date" locale="fr" placeholder={["Date de début","Date de fin"]} separator="-" onChange={this.handleDateCChange}value={this.state.dateIC} format="DD/MM/YYYY" allowClear={false}/></LocaleProvider><label className="pt-label .modifier"><strong>Heure de debut</strong></label><时间值={el.startC} onChange={时间=>this.handleKeyboardStartCChange(i, time)} style={heure} disableUnderline={true} inputComponent={TextMaskCustom}endAdornment={ <InputAdornment position="end" style={{opacity:'0.4'}}><图标按钮 onClick={() =>this.openDialogC(i, el.startC, "startC")}><i style={{fontSize:'18px'}} className="zmdi zmdi-alarm"/></IconButton></InputAdornment>}/><label className="pt-label .modifier"><strong>Heure de fin</strong></label><时间值={el.endC} onChange={时间=>this.handleKeyboardEndCChange(i, time)} style={heure} disableUnderline={true} inputComponent={TextMaskCustom}endAdornment={ <InputAdornment position="end" style={{opacity:'0.4'}}><图标按钮 onClick={() =>this.openDialogC(i, el.endC, "endC")}><i style={{fontSize:'18px'}} className="zmdi zmdi-alarm"/></IconButton></输入装饰>}/><Clock maxWidth="xs" open={this.state.isOpenC} onBackdropClick={this.closeDialogC}><TimePicker mode="24h" value={this.createDateFromTextValueC(this.state.datePickerValueC)} onChange={this.handleDialogCChange}/><对话动作><ButtonOk onClick={this.closeDialogC} color="primary">好的 </ButtonOk></DialogActions></时钟><AnchorButton style={{display:'inline-block'}} intent={Intent.SUCCESS} onClick={this.handleValider}>Valider</AnchorButton></div>);}}<小时>
我想刷新我的事件列表,并在弹出窗口的发布表单之后而不是在刷新页面之后显示我的事件添加到日历中,我将重新选择医生.
我该如何解决?
解决方案 不要在你的 state 中保存事件,在 Popup 中直接从 props 访问事件.
在您的日历中,创建一个将更新状态的函数.
updateEvents = (事件,回调 = () => {}) =>{这个.setState({事件},打回来);};<Popup updateEvents={this.updateEvents} ref={this.ModalAjoutb} id_user={this.state.id_user} events={this.state.events}/>
弹出窗口
export default class Popup extends Component {构造函数(道具){超级(道具);}handleAjouterb = id_user =>{这个.setState({openPopupAjout:是的,id_user},() =>{this.fetchingPopup(this.state.id_user,this.state.identifiant_user,this.state.nom_user);});};fetchingPopup = (id_user, identifiant_user, nom_user) =>{const praticiensCached = JSON.parse(localStorage.getItem('Liste de praticiens '));for (让 j = 0; j < praticiensCached.length; j++) {if (id_user === praticiensCached[j].id_user) {identifiant_user = praticiensCached[j].identifiant_user;this.setState({ nom_user: praticiensCached[j].nom_user });}}句柄验证器 = 事件 =>{event.preventDefault();const praticiensCached = JSON.parse(localStorage.getItem('Liste de praticiens '));for (让 j = 0; j < praticiensCached.length; j++) {if (this.state.id_user === praticiensCached[j].id_user)this.state.identifiant_user = praticiensCached[j].identifiant_user;}常量 formData = new FormData();formData.append('identifiant_user', this.state.identifiant_user);formData.append('heuredebut', this.state.tranchesC[0].startC);formData.append('heurefin', this.state.tranchesC[0].endC);formData.append('libelleconge', this.state.libelle);轴({方法:'发布',网址:process.env.REACT_APP_API_BACKEND + 'add_event_docteur',数据:表格数据,标题:{'内容类型':'应用程序/json',接受:'应用程序/json'}}).then(() => {拿来(process.env.REACT_APP_API_BACKEND +'get_liste_planning/开始=' +片刻().startOf('isoweek').subtract(14, '天').toJSON() +'&end=' +片刻().endOf('等周').add(2, '月').toJSON() +'&identifiant_user=' +this.state.identifiant_user).then(响应 => Response.json()).then(数据 => {让 evts = data.ListeResult;for (让 i = 0; i < evts.length; i++) {evts[i].start = moment(evts[i].start).toDate();evts[i].end = moment(evts[i].end).toDate();}this.props.updateEvents(evts, () => {localStorage.setItem('Liste récente de planning de' + this.state.nom_user,JSON.stringify(evts));localStorage.removeItem('Liste de planning de' + this.state.nom_user);localStorage.setItem('Liste de planning de ' + this.state.nom_user,JSON.stringify(evts));});});});};};使成为() {返回 (<对话图标=应用程序"onClose={this.handleClose}标题=博士计划组织"{...this.state}isOpen={this.state.openPopupAjout}><输入id=丽贝尔";样式={{宽度:'480px'}}价值={this.state.libelle}onChange={this.handleInputChange('libelle')}/><label className="pt-label .modifier"><strong>日期</strong></标签><LocaleProvider 语言环境={fr_FR}><范围选择器id=日期";名称=日期";语言环境=fr";placeholder={['Date de debut', 'Date de fin']}分隔符=-";onChange={this.handleDateCChange}值={this.state.dateIC}格式=DD/MM/YYYY";允许清除={假}/></LocaleProvider><label className="pt-label .modifier">{''}<strong>Heure de debut</strong></标签><时间值={el.startC}onChange={时间=>this.handleKeyboardStartCChange(i, time)}风格={heure}禁用下划线={true}inputComponent={TextMaskCustom}结束装饰={<输入装饰位置=结束";样式={{不透明度:'0.4'}}>{''}<图标按钮onClick={() =>this.openDialogC(i, el.startC, 'startC')}><i style={{ fontSize: '18px' }} className="zmdi zmdi-alarm"/></图标按钮>{' '}</输入装饰>}/><label className="pt-label .modifier">{''}<strong>Heure de fin</strong></标签><时间价值={el.endC}onChange={时间=>this.handleKeyboardEndCChange(i, time)}风格={heure}禁用下划线={true}inputComponent={TextMaskCustom}结束装饰={<输入装饰位置=结束";样式={{不透明度:'0.4'}}>{''}<图标按钮onClick={() =>this.openDialogC(i, el.endC, 'endC')}><i style={{ fontSize: '18px' }} className="zmdi zmdi-alarm"/></图标按钮></输入装饰>}/><时钟最大宽度=xs";打开={this.state.isOpenC}onBackdropClick={this.closeDialogC}><时间选择器模式=24小时"值={this.createDateFromTextValueC(this.state.datePickerValueC)}onChange={this.handleDialogCChange}/><对话动作>{''}<ButtonOk onClick={this.closeDialogC} color=primary">{''}行{' '}</按钮确定></DialogActions></时钟><锚按钮样式={{ 显示:'inline-block' }}意图={意图.成功}onClick={this.handleValider}>验证器</锚按钮></div>);}}I have a react-big-calendar (The parent container), I have also a select which, the events of the calendar are fetched according to this select ( doctor name ) and I have a button when I click on it, the dialog will be appears (another component), on this dialog, I have a form to add an event after the select, when I post my API, I save it on local storage, but the event added doesn't appears on my calendar just after refresh the page and reselect the doctor name.
But I want, when I click on the save button, will be added directly on the calendar and it will be appeared on the calendar.
My code of calendar is :
import Popup from './Popup';
export default class Calendar extends Component {
constructor(props){
super(props);
this.state = {
events : [],
open: false,
}}
componentDidMount = () => {
fetch(process.env.REACT_APP_API_BACKEND_YET+'get_liste_praticien.php')
.then(Response => Response.json())
.then(data => {
this.setState ({ praticiens : data })
localStorage.setItem('Liste de praticiens ', JSON.stringify(this.state.praticiens))
})
}
fetchData = (nom,identifiant_user) => {
this.setState({
events: [],
evtStorage:[],
prevEvents:[],
evtBackend:[]
})
fetch(process.env.REACT_APP_API_BACKEND+'get_liste_planning')
.then(Response => Response.json())
.then(data => {
let evts = data.ListeResult;
for (let i = 0; i < evts.length; i++) {
evts[i].start = moment(evts[i].start).toDate();
evts[i].end = moment(evts[i].end).toDate();
if(evts[i].typeplanning === '0') this.setState({isConges:true})
this.state.events.push(evts[i])
}
this.setState({
evtBackend: evts,
events: evts
})
localStorage.setItem("Liste de planning de " + nom, JSON.stringify(this.state.events));
})
const evtCached1 = JSON.parse(localStorage.getItem('Liste récente de planning de ' + nom));
if(evtCached1 !== null) {
for (let j = 0; j < evtCached1.length; j++) {
evtCached1[j].start = moment(evtCached1[j].start).toDate();
evtCached1[j].end = moment(evtCached1[j].end).toDate();
if(evtCached1[j].typeplanning === '0') this.setState({isConges:true})
this.state.events.push(evtCached1[j]);
}
this.setState({
events:this.state.events,
});
localStorage.removeItem("Liste de planning de " + nom);
}}
// For the select
handlePraticienChange = id_user => {
this.setState({
openPopupAjout: true,
id_user: id_user
},() => {
this.state.praticiens.map((praticien)=> {
if(this.state.id_user === praticien.id_user){
this.setState ({ nom_user: praticien.nom_user})
this.fetchData(praticien.nom_user, praticien.identifiant_user);
}
})
}
);
}
// for the popup
ModalAjoutb = (ref) => {
if (ref) {
this.ajoutb = ref.handleAjouterb;
} else {
this.ajoutb = null;
}
}
render() {
return (
<div>
<button className="bp3-button bp3-icon-add-to-artifact .bp3-fill" tabIndex="0" onClick={() => this.ajoutb(this.state.id_user, this.state.events)}>Add event</button>
<Select onChange={this.handlePraticienChange} value={this.state.id_user}>
{this.state.praticiens.map((praticien) =>
<Option key={praticien.id_user} value={praticien.id_user}>{praticien.nom_user}</Option>
)}
</Select>
<DragAndDropCalendar
selectable
localizer={localizer}
events={this.state.events}
views={['month','week','day']}
defaultView="week"
culture = 'fr'
/>
<Popup ref={this.ModalAjoutb} id_user={this.state.id_user} events={this.state.events} />
</div>
);
}}
My code of dialog is :
export default class Popup extends Component {
constructor(props){
super(props);
this.state = {
events : [],
}}
handleAjouterb = (id_user) => {
this.setState({
openPopupAjout: true,
id_user,
}, () => {
this.fetchingPopup(this.state.id_user, this.state.identifiant_user, this.state.nom_user)
});
}
fetchingPopup = (id_user, identifiant_user, nom_user) =>{
const praticiensCached = JSON.parse(localStorage.getItem('Liste de praticiens '));
for (let j = 0; j < praticiensCached.length; j++) {
if(id_user === praticiensCached[j].id_user){
identifiant_user = praticiensCached[j].identifiant_user;
this.setState ({ nom_user: praticiensCached[j].nom_user })
}
}
handleValider = event => {
event.preventDefault();
const praticiensCached = JSON.parse(localStorage.getItem('Liste de praticiens '));
for (let j = 0; j < praticiensCached.length; j++) {
if(this.state.id_user === praticiensCached[j].id_user)
this.state.identifiant_user = praticiensCached[j].identifiant_user;
}
const formData = new FormData();
formData.append('identifiant_user', this.state.identifiant_user);
formData.append('heuredebut', this.state.tranchesC[0].startC);
formData.append('heurefin', this.state.tranchesC[0].endC);
formData.append('libelleconge', this.state.libelle);
axios({
method: 'post',
url: process.env.REACT_APP_API_BACKEND+'add_event_docteur',
data: formData,
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
}
})
.then(() => {
fetch(process.env.REACT_APP_API_BACKEND+'get_liste_planning/start='+moment().startOf('isoweek').subtract(14,'days').toJSON()+'&end='+moment().endOf('isoweek').add(2,'months').toJSON()+'&identifiant_user='+this.state.identifiant_user)
.then(Response => Response.json())
.then(data => {
let evts = data.ListeResult;
for (let i = 0; i < evts.length; i++) {
evts[i].start = moment(evts[i].start).toDate();
evts[i].end = moment(evts[i].end).toDate();
this.state.events.push(evts[i])
}
this.setState({
events: this.state.events
}, ()=> {
localStorage.setItem('Liste récente de planning de ' + this.state.nom_user, JSON.stringify(this.state.events));
localStorage.removeItem("Liste de planning de " + this.state.nom_user);
localStorage.setItem("Liste de planning de " + this.state.nom_user, JSON.stringify(this.state.events));
})
})
})
}
render() {
return (
<div>
<Dialog
icon="application"
onClose={this.handleClose}
title="Organisation des plannings du docteur"
{...this.state}
isOpen={this.state.openPopupAjout}>
<Input id="libelle" style={{ width: '480px' }} value={this.state.libelle} onChange={this.handleInputChange('libelle')}/>
<label className="pt-label .modifier"><strong>Date</strong></label>
<LocaleProvider locale={fr_FR}>
<RangePicker id="date" name= "date" locale="fr" placeholder={["Date de début","Date de fin"]} separator="-" onChange={this.handleDateCChange}
value={this.state.dateIC} format="DD/MM/YYYY" allowClear={false}/>
</LocaleProvider>
<label className="pt-label .modifier"> <strong>Heure de début</strong></label>
<Time value={el.startC} onChange={time => this.handleKeyboardStartCChange(i, time)} style={heure} disableUnderline={true} inputComponent={TextMaskCustom}
endAdornment={ <InputAdornment position="end" style={{opacity:'0.4'}}> <IconButton onClick={() => this.openDialogC(i, el.startC, "startC")}><i style={{fontSize:'18px'}} className="zmdi zmdi-alarm" /></IconButton> </InputAdornment>}
/>
<label className="pt-label .modifier"> <strong>Heure de fin</strong></label>
<Time value={el.endC} onChange={time => this.handleKeyboardEndCChange(i, time)} style={heure} disableUnderline={true} inputComponent={TextMaskCustom}
endAdornment={ <InputAdornment position="end" style={{opacity:'0.4'}}> <IconButton onClick={() => this.openDialogC(i, el.endC, "endC")}><i style={{fontSize:'18px'}} className="zmdi zmdi-alarm" /></IconButton></InputAdornment> }/>
<Clock maxWidth="xs" open={this.state.isOpenC} onBackdropClick={this.closeDialogC}>
<TimePicker mode="24h" value={this.createDateFromTextValueC(this.state.datePickerValueC)} onChange={this.handleDialogCChange}/>
<DialogActions> <ButtonOk onClick={this.closeDialogC} color="primary"> Ok </ButtonOk></DialogActions>
</Clock>
<AnchorButton style={{display:'inline-block'}} intent={Intent.SUCCESS} onClick={this.handleValider}>Valider</AnchorButton>
</div>
);
}}
I want to refresh the list of my events and appear my event added on the calendar afer post form on the popup and not after the refresh of the page and I will reselect the doctor.
How can I fix it ?
解决方案 Don't save events in your state, in Popup access the events directly from props.
In your Calendar, create a function that'll update the state.
updateEvents = (events, callback = () => {}) => {
this.setState(
{
events
},
callback
);
};
<Popup updateEvents={this.updateEvents} ref={this.ModalAjoutb} id_user={this.state.id_user} events={this.state.events} />
Popup
export default class Popup extends Component {
constructor(props) {
super(props);
}
handleAjouterb = id_user => {
this.setState(
{
openPopupAjout: true,
id_user
},
() => {
this.fetchingPopup(
this.state.id_user,
this.state.identifiant_user,
this.state.nom_user
);
}
);
};
fetchingPopup = (id_user, identifiant_user, nom_user) => {
const praticiensCached = JSON.parse(
localStorage.getItem('Liste de praticiens ')
);
for (let j = 0; j < praticiensCached.length; j++) {
if (id_user === praticiensCached[j].id_user) {
identifiant_user = praticiensCached[j].identifiant_user;
this.setState({ nom_user: praticiensCached[j].nom_user });
}
}
handleValider = event => {
event.preventDefault();
const praticiensCached = JSON.parse(
localStorage.getItem('Liste de praticiens ')
);
for (let j = 0; j < praticiensCached.length; j++) {
if (this.state.id_user === praticiensCached[j].id_user)
this.state.identifiant_user = praticiensCached[j].identifiant_user;
}
const formData = new FormData();
formData.append('identifiant_user', this.state.identifiant_user);
formData.append('heuredebut', this.state.tranchesC[0].startC);
formData.append('heurefin', this.state.tranchesC[0].endC);
formData.append('libelleconge', this.state.libelle);
axios({
method: 'post',
url: process.env.REACT_APP_API_BACKEND + 'add_event_docteur',
data: formData,
headers: {
'Content-Type': 'application/json',
Accept: 'application/json'
}
}).then(() => {
fetch(
process.env.REACT_APP_API_BACKEND +
'get_liste_planning/start=' +
moment()
.startOf('isoweek')
.subtract(14, 'days')
.toJSON() +
'&end=' +
moment()
.endOf('isoweek')
.add(2, 'months')
.toJSON() +
'&identifiant_user=' +
this.state.identifiant_user
)
.then(Response => Response.json())
.then(data => {
let evts = data.ListeResult;
for (let i = 0; i < evts.length; i++) {
evts[i].start = moment(evts[i].start).toDate();
evts[i].end = moment(evts[i].end).toDate();
}
this.props.updateEvents(evts, () => {
localStorage.setItem(
'Liste récente de planning de ' + this.state.nom_user,
JSON.stringify(evts)
);
localStorage.removeItem(
'Liste de planning de ' + this.state.nom_user
);
localStorage.setItem(
'Liste de planning de ' + this.state.nom_user,
JSON.stringify(evts)
);
});
});
});
};
};
render() {
return (
<div>
<Dialog
icon="application"
onClose={this.handleClose}
title="Organisation des plannings du docteur"
{...this.state}
isOpen={this.state.openPopupAjout}
>
<Input
id="libelle"
style={{ width: '480px' }}
value={this.state.libelle}
onChange={this.handleInputChange('libelle')}
/>
<label className="pt-label .modifier">
<strong>Date</strong>
</label>
<LocaleProvider locale={fr_FR}>
<RangePicker
id="date"
name="date"
locale="fr"
placeholder={['Date de début', 'Date de fin']}
separator="-"
onChange={this.handleDateCChange}
value={this.state.dateIC}
format="DD/MM/YYYY"
allowClear={false}
/>
</LocaleProvider>
<label className="pt-label .modifier">
{' '}
<strong>Heure de début</strong>
</label>
<Time
value={el.startC}
onChange={time => this.handleKeyboardStartCChange(i, time)}
style={heure}
disableUnderline={true}
inputComponent={TextMaskCustom}
endAdornment={
<InputAdornment position="end" style={{ opacity: '0.4' }}>
{' '}
<IconButton
onClick={() => this.openDialogC(i, el.startC, 'startC')}
>
<i style={{ fontSize: '18px' }} className="zmdi zmdi-alarm" />
</IconButton>{' '}
</InputAdornment>
}
/>
<label className="pt-label .modifier">
{' '}
<strong>Heure de fin</strong>
</label>
<Time
value={el.endC}
onChange={time => this.handleKeyboardEndCChange(i, time)}
style={heure}
disableUnderline={true}
inputComponent={TextMaskCustom}
endAdornment={
<InputAdornment position="end" style={{ opacity: '0.4' }}>
{' '}
<IconButton
onClick={() => this.openDialogC(i, el.endC, 'endC')}
>
<i style={{ fontSize: '18px' }} className="zmdi zmdi-alarm" />
</IconButton>
</InputAdornment>
}
/>
<Clock
maxWidth="xs"
open={this.state.isOpenC}
onBackdropClick={this.closeDialogC}
>
<TimePicker
mode="24h"
value={this.createDateFromTextValueC(this.state.datePickerValueC)}
onChange={this.handleDialogCChange}
/>
<DialogActions>
{' '}
<ButtonOk onClick={this.closeDialogC} color="primary">
{' '}
Ok{' '}
</ButtonOk>
</DialogActions>
</Clock>
<AnchorButton
style={{ display: 'inline-block' }}
intent={Intent.SUCCESS}
onClick={this.handleValider}
>
Valider
</AnchorButton>
</div>
);
}
}
这篇关于如何通过反应将数据从对话框发送回父容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
The End
相关推荐
在JavaScript中,我们有多种方法可以删除数组中的指定元素。以下给出了5种常见的方法并提供了相应的代码示例: 1.使用splice()方法: let array = [0, 1, 2, 3, 4, 5];let index = array.indexOf(2);if (index -1) { array.splice(index, 1);}// array = [0,...
2024-11-22
前端开发问题
182
在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会...
2024-10-18
前端开发问题
301
问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转...
2024-10-17
前端开发问题
437
如果你想在 layui 的 table 列表中增加 edit=date 属性但不生效,可能是以下问题导致的: 1. 缺少日期组件的初始化 如果想在表格中使用日期组件,需要在页面中引入 layui 的日期组件,并初始化: script type="text/javascript" src="/layui/layui.js"/scrip...
2024-06-11
前端开发问题
455
layui.render控制某一列是否可以编辑,先看代码: ,done:function (res, curr, count){//设置查看量那一列的通过status决定是否可以编辑 let tableView = this.elem.next(); layui.each(res.data, function(i, item) { console.log("curr",curr) if (item.sta...
2024-06-11
前端开发问题
326
Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)...
2024-04-20
前端开发问题
5
热门文章
1错误 [ERR_REQUIRE_ESM]:不支持 ES 模块的 require()
2vue中yarn install报错:info There appears to be trouble with you
3为什么 Chrome(在 Electron 内部)会突然重定向到 chrome-error://chromewebdat
4“aria-hidden 元素不包含可聚焦元素"显示模态时的问题
5使用选择器在 CSS 中选择元素的前一个兄弟
6js报错:Uncaught SyntaxError: Unexpected string
7layui怎么刷新当前页面?
8将模式设置为“no-cors"时使用 fetch 访问 API 时出错
热门精品源码
最新VIP资源
1多功能实用站长工具箱html功能模板
2多风格简历在线生成程序网页模板
3论文相似度查询系统源码
4响应式旅游景点宣传推广页面模板
5在线起名宣传推广网站源码
6酷黑微信小程序网站开发宣传页模板
7房产销售交易中介网站模板
8小学作业自动生成程序


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)