这些是我尚未遇到的问题:
有人可以帮我吗?
答案 0 :(得分:0)
开箱即用,React在与自定义元素(例如Stencil组件)集成方面存在问题-您可以在https://custom-elements-everywhere.com/上查看更多详细信息以及一些解决方法。
为帮助进行这种集成,可以使用React的绑定层扩展Stencil组件,该绑定层将自定义元素转换为可使用的React组件。有关详情,请参见此处:https://github.com/ionic-team/stencil-ds-plugins#react
答案 1 :(得分:0)
我个人使用我自己的github实例,在其中将带有dist和loader文件夹的整个Web组件项目上载到github。之后,您可以使用此命令将项目加载到React应用程序的npm-modules中。它的工作原理类似于您的github存储库中的npm install
。
git+https://my-github-instance/web-components/my-components.git
如果您在运行时遇到问题,这里有一些详细信息。
How to install an npm package from GitHub directly?
比起npm update / npm install,您可以在React应用程序中获取最新的Web组件版本。
Stencil的文档非常详细地介绍了如何在React中使用Web组件:
https://stenciljs.com/docs/react
祝你好运