React静态文件不在html中呈现

时间:2021-07-08 09:29:52

标签: reactjs strapi koa shopify-app shopify-template

我一直在用流动文件渲染 React HTML。

我总共有 3 个应用程序。

Strapi - https://my-api.com
React App - https://my-react-app.com
shopify store - https://shopify-store.com

GET https://shopify-store.com  ->>  GET https://my-api.com/api/get-form

上述 URL 请求由 Shopify 商店应用发送到我的 Strapi 服务器,我必须返回一个 HTML。

/api/*/controller/fileName.js

const { data } = await axios.get('https://my-react-app.com/form-page');
// the above data contains react's html
ctx.send(data); // returning react's HTML to shopify store

我已经完成了上面的方法,它返回了 HTML,但它没有在 UI 中呈现 Html。 如果您从屏幕截图中注意到,<div id="main"></div> 是空的。

enter image description here

请帮我找到渲染 HTML 的解决方案...

谢谢。

1 个答案:

答案 0 :(得分:0)

假设您的应用通过 Script 标签 api 更改液体文件。

以字符串形式返回你的html

width : 100%; height:100%

请提供您收到 html 的文件的更多详细信息,并将其设置为 shopify 商店。