简体   繁体   English

如何将可组合预览绘制到 HTML 文件

[英]How to draw Composable Preview to HTML file

This is a general question, I'm looking for ideas.这是一个普遍的问题,我正在寻找想法。 The goal is to write a documentation system.目标是编写一个文档系统。
So, I want to draw my Composable function on the HTML page.所以,我想在 HTML 页面上绘制我的可组合 function。
What comes to my mind:我想到了什么:

  1. @Preview already draws it somehow but I'm not sure that it's easy to adapt it to HTML. @Preview已经以某种方式绘制了它,但我不确定它是否容易适应 HTML。 At the first glance, I haven't found such possibility.乍一看,我还没有发现这种可能性。
  2. It's possible to draw the view on the emulator, take screenshot as Bitmap and upload this Bitmap.可以在模拟器上绘制视图,截图为Bitmap并上传这个Bitmap。 But this adds emulator dependency for generation which I'd like to avoid.但这增加了模拟器对生成的依赖,我想避免。

Perhaps, anyone has already worked on this problem?也许,有人已经解决了这个问题? Appreciate any hints.感谢任何提示。

I don't think it's possible to render Composables for android in HTML as compose is targeting JVM.我认为不可能在 HTML 中呈现 android 的可组合物,因为 compose 的目标是 JVM。

Depending on your use case Compose for Web might be helpful for you根据您的用例撰写 Web可能对您有帮助

For removing the emulator from your process you might prefer Compose for Desktop要从您的进程中删除模拟器,您可能更喜欢Compose for Desktop

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM