javascript - 日历 iframe 不显示所有最新创建的事件(尤其是共享日历事件)

标签 javascript reactjs iframe google-calendar-api google-api-js-client

我已经设法将 Google 日历嵌入到 React 组件中,但问题是我可以观察到嵌入式日历没有获取添加到通过 gapi 验证的电子邮件的最新事件。 .

日历iframe URL是这个https://calendar.google.com/calendar/b/1/embed?src={VALID_CALENDAR_EMAIL}

calendar.util.js

const CALENDAR_EMBED_BASE_URL =
  'https://calendar.google.com/calendar/embed?src=';

export const getCalendarEmbedUrl = email =>
  `${CALENDAR_EMBED_BASE_URL}${email}`;

CalendarIframe.jsx 组件

import React, { PureComponent } from 'react';
import { getCalendarEmbedUrl } from 'calendar.util.js';

class CalendarIframe extends PureComponent {
  render() {
    const { email } = this.props;
    const embedUrl = getCalendarEmbedUrl(email);

    return (
      <div className="calendarEmbedWrapper">
        <iframe
          title="Calendar"
          id="calendarEmbed"
          width="100%"
          src={embedUrl}
        />
      </div>
    );
  }
}

有什么方法可以确保嵌入式日历具有应有的动态性?

最佳答案

我想出了解决嵌入式日历问题的方法。在嵌入字符串中,我只需将所有 calendarIds 附加到字符串中,如下所示: https://calendar.google.com/calendar/embed?src=calendarID + &src=anotherCalendarId

https://calendar.google.com/calendar/embed?src=email@email.com&src=anothercalendar@group.calendar.google.com

它将显示来自多个嵌入的日历 ID 的所有事件。

关于javascript - 日历 iframe 不显示所有最新创建的事件(尤其是共享日历事件),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57569078/

相关文章:

javascript - React.js : e. PreventDefault(…) 不是一个函数

javascript - $(window).blur 事件影响 Iframe

javascript - work 函数如何返回另一个接受另一个参数的函数?

javascript - Amazon aStore 的动态高度

javascript - 从 Iframe 创建一个新的 chrome 选项卡/窗口

javascript - 函数仅保存并打印数组中的一个值。如何修复它?

javascript - 获取特定数组值

javascript - 粘性导航的奇怪问题

javascript - 使用 JavaScript 更改突出显示文本的字体

javascript - ./app/main.js 中的错误模块构建失败 : SyntaxError: Unexpected token (10:18)