1

我正在尝试将特定页面的 twitter 时间线嵌入到 react-bootstrap 面板中,但是我无法使其正常工作。我没有得到任何控制台日志输出,这让我认为我没有正确设置它,但是我不确定问题是什么。我正在使用react-twitter-widgets嵌入时间线。

我的组件如下:

import React from 'react';
import { Timeline } from 'react-twitter-widgets';

function twitterTimeline() {
  return (
    <Timeline
      dataSource={{
        sourceType: 'profile',
        screenName: 'MetEireann',
      }}
      options={{
        username: 'MetEireann',
        height: '400',
      }}
      onLoad={() => console.log('Timeline is loaded!')}
    />
  );
}

export default twitterTimeline;

然后我在我的 react-bootstrap 面板中使用它:

import twitterTimeline from '../../components/TwitterTimeline';
.....

<div className="col-lg-4">
   <Panel
     header={<span>
       <i className="fa fa-bar-chart fa-fw" /> Weather Forecast
       </span>}
    >
      <twitterTimeline />
    </Panel>
</div>

正在加载组件,因此问题显然出在组件本身上。 在此处输入图像描述

任何帮助将不胜感激。提前致谢。

4

0 回答 0