javascript - 使用带有预加载 HTML 的 React
问题描述
这是我的场景。
- 我想使用 React 从 CMS 加载数据
- CMS 吐出 HTML (Webflow)
- 我设置了一个 HTML/CSS 页面,在一个页面上显示 10 个应用程序“屏幕”
- 我想获取它吐出的 HTML,将其加载到 React 中,然后使用反应导航、滑动器等对其进行操作。
例子:
<body>
<div id="react-target">
<section id="main">
<h1>Title goes here</h1>
<p>Text goes here</p>
</section>
<section id="section2">
<h1>Title goes here</h1>
<p>Text goes here</p>
</section>
<section id="section3">
<h1>Title goes here</h1>
<p>Text goes here</p>
</section>
<section id="section4">
<h1>Title goes here</h1>
<p>Text goes here</p>
</section>
</div>
</body>
有没有办法“反应”这个 dom 内容?我想获取这些 DOM 内容(包括视觉表示),然后将它们变成可滑动的全屏“页面”,类似于 jQuery / SwiperJS 的工作方式。
解决方案
推荐阅读
- mongodb - 使用 updateMany MongoDb 函数有什么缺点或限制吗?
- javascript - 代码同时运行(打字机效果)
- c# - SQLite syntax error inside of command: 'SQL logic error near "=": syntax error'
- spring - 如何在不更改编码的情况下使用 spring 返回文件,或者只设置 UTF-8-BOM 编码
- react-native - 将图像 url 作为参数传递给 react-navigation Deeplink
- prometheus - Grafana 自我指标和跟踪警报触发器
- gcc - /usr/bin/ld: 找不到 /usr/lib64/libpthread_nonshared.a
- java - 升级到 Gradle 7 后 Android Gradle Javadoc 损坏
- swift - 如何在 Swift 5.5 中将 List 中的新绑定与子项一起使用?
- javascript - 如何在href中使用没有id的目标子div?