javascript - Instagram 嵌入式代码未在我的 React 应用程序中显示图像

标签 javascript html css reactjs instagram

我正在尝试将 Instagram 嵌入到我的 React 应用程序中,但由于某种原因,图像没有被渲染。

最佳答案

这解决了这个问题:

 this.setState({
                    mainImage: data.mainImage,
                    uuid: data.uuid,
                    title: data.title,
                    author: data.author,
                    tags: data.tags,
                    premium: data.premium,
                    preamble: data.preamble,
                    body: data.body,
                    publishingTime: data.publishingTime,
                },() =>{
                    const instagramScript = document.createElement("script");
                    instagramScript.src = "//www.instagram.com/embed.js";
                    instagramScript.async = true;
                    document.body.appendChild(instagramScript);

                    const twitterScript = document.createElement("script");
                    twitterScript.src = "https://platform.twitter.com/widgets.js";
                    twitterScript.charset = "utf-8";
                    twitterScript.async = true;
                    document.body.appendChild(twitterScript);
                });

关于javascript - Instagram 嵌入式代码未在我的 React 应用程序中显示图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55001530/

相关文章:

javascript - 如何使用 C++ 插件中内置的 node.js 模块

javascript - 浏览 OLAP 多维数据集

javascript - 在鼠标悬停时,我的文字和图像以一种奇怪的方式在左侧移动

css - 盒子阴影在同一个 div 的内部和外部

javascript - html5 使用 bezierCurveTo 绘制高斯函数

javascript - 从 WFS 加载时,不会维护 OpenLayers 几何名称

javascript - Ajax 在提交时执行不同的表单

html - 调整表单大小、输入文本和字体高度时出现问题

javascript - 使 Canvas 球平稳移动

html - 如何将父 DIV 中的两个 DIVS 居中并确保图像不与左侧 DIV 重叠