fullcalendar选项businessHours:从数据输入数组中删除“ ...”

时间:2019-05-10 17:32:45

标签: javascript reactjs fullcalendar fullcalendar-scheduler

需要从“资源加载”选项中删除引号-

businessHours: "[{ daysOdWeek...... }]"

以便数据读取->

businessHours: [{ daysOdWeek...... }]

正在编写React Web App。带有Firestore数据库的完整日历-scheduler 4。*。

     (app...j sx )

     super...
      this.state ={
     ....
      calDataEvents: [],
      calDataResources: []
       ....

     <FullCalendar
    .....
           resources={ this.state.calDataResources }
            events={ this.state.calDataEvents }
      />

      onResourcesCollectionUpdate = (querySnapshot) => {
     const calDataResources = []

    querySnapshot.forEach((doc) => {

     calDataResources.push({
        id: doc.id,
        title: doc.data().title,
        resourcesSort: doc.data().resourcesSort,
        businessHours: doc.data().businessHours
      })
    })
         this.setState({
      calDataResources 
         }).......

     componentDidMount() {
        this.subscribeResources = 


       this.refResources.orderBy("resourcesSort")
      .onSnapshot(this.onResourcesCollectionUpdate)

 chrome consol>log-----
  businessHours: "[{ daysOfWeek: [ 0 ], startTime: '09:00', 
 endTime:'11:30' }, { da......' }]"

在控制台日志中可以看到-数组具有“”-businessHours:  需要一个不在字符串中的纯数组。

以下Full Cal ..选项硬代码有效。...

 resources={[
    { id: "a", title: "John Hi-lights" , businessHours: [{ 
   daysOfWeek: [ 0 ],......
    ]}

0 个答案:

没有答案