在 iframe 中加载远程 URL。
要使用此函数,请从以下模块导入它:streamlit.components.v1模块。
警告
直接使用st.components.v1.iframe(而不是导入其模块)已被弃用,并将在更高版本中禁止使用。
函数签名[源] | |
---|---|
st.components.v1.iframe(src, width=None, height=None, scrolling=False, *, tab_index=None) | |
参数 | |
src (str) | 要嵌入的页面的 URL。 |
width (int) | iframe 的宽度,单位为 CSS 像素。默认为应用程序的默认元素宽度。 |
height (int) | iframe 的高度,单位为 CSS 像素。默认为150. |
scrolling (bool) | 是否允许 iframe 中的滚动。如果设置为False(默认值),Streamlit 会裁剪比 iframe 大的内容,并且不显示滚动条。如果设置为True,当内容比 iframe 大时,Streamlit 会显示滚动条。 |
tab_index (int 或 None) | 指定 iframe 是否以及如何按顺序获得焦点。用户通常使用Tab键进行顺序焦点导航。 可以是以下值之一:
有关更多信息,请参阅 MDN 上的 tabindex 文档。 |
示例
import streamlit.components.v1 as components components.iframe("https://example.com", height=500)
还有问题吗?
我们的 论坛 提供了大量有用的信息和 Streamlit 专家。