streamlit手机版友好去掉下来刷新和右下角home

import streamlit as st

自定义HTML和JavaScript代码

html_code = """
<!DOCTYPE html>
<html>
<head>

<title>Disable Pull to Refresh</title>
<script>
    // 禁用下拉刷新功能
    document.addEventListener('touchmove', function(event) {
        if (event.touches.length > 1) {
            event.preventDefault();
        }
    }, { passive: false });

    document.addEventListener('touchstart', function(event) {
        if (event.touches.length > 1) {
            event.preventDefault();
        }
    }, { passive: false });
</script>

</head>
<body>

<h1>Streamlit App</h1>

</body>
</html>
"""

使用Streamlit的components.html嵌入自定义HTML和JavaScript

st.components.v1.html(html_code, height=200)

你的Streamlit应用内容

st.write("这是你的Streamlit应用内容。")

——————@
import streamlit as st

自定义CSS和JavaScript代码

html_code = """
<style>
/ 隐藏右下角的Home按钮 /
.css-1lsmgbg.egzxvld1 {

display: none;

}
</style>
"""

使用Streamlit的components.html嵌入自定义HTML和JavaScript

st.components.v1.html(html_code, height=0)

你的Streamlit应用内容

st.write("这是你的Streamlit应用内容。")

发表新评论