Joj*_*rte 5 javascript iframe google-calendar-api reactjs gapi
我已经设法将Google日历嵌入到React组件中,但是问题是我可以观察到嵌入式日历没有获得最新事件,该事件已添加到通过验证的电子邮件中gapi。
日历iframe网址是这个 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}`;
Run Code Online (Sandbox Code Playgroud)
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>
);
}
}
Run Code Online (Sandbox Code Playgroud)
如何确保嵌入式日历具有应有的动态性?
我想出了如何解决嵌入式日历问题。在嵌入字符串中,我只需将所有 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 的所有事件。
| 归档时间: |
|
| 查看次数: |
79 次 |
| 最近记录: |