javascript - 在使用 React 等前端技术时在网页中显示嵌入的社交数据
问题描述
如何在 reactjs 中显示来自 twitter 的嵌入社交数据,其中已经有脚本标签来设置样式和呈现 twitter 并在数据库表中硬编码一些内容?在单体站点中,它工作正常。在前端基于它不起作用。
例如以文本形式存储在 db 表中的内容:
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
<blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">I just published “Making Sense of React Hooks” <a href=""></a></p>— Dan Abramov (@dan_abramov) <a href="https://twitter.com/dan_abramov/status/1057319198626594816?ref_src=twsrc%5Etfw">October 30, 2018</a></blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
这个脚本 twitter 不会加载默认的小部件布局,同时使用它周围的一些段落作为硬编码内容做出反应。
解决方案
推荐阅读
- julia - julia 1.0 安装测试 - nix-pkgs - ubuntu
- java - 从样本列表中获取项目
- node.js - 如何使用nodejs将数组元素作为每个元素推送到mongodb的嵌套数组中
- unity3d - 光晕和镜头光晕
- javascript - 单选按钮作为选项卡窗格控件
- angular - Angular:如何最好地处理初始化/加载问题
- r - 查找共享一个共同水平的两个水平的值的比例
- python - Python for -m pip install (...) 中的无效语法尝试了一切
- php - PHP:xpath 替换内容标签
- data-conversion - 如何在 python 3.7 中将 ascii 字符串更改为十六进制,反之亦然?