Closed yaqiangsun closed 8 months ago
The code:
import streamlit as st import extra_streamlit_components as stx def main(): cookie_manager = stx.CookieManager("main") # 定义cookie管理器 print("cookie_manager:",cookie_manager.get(cookie='authenticated')) if cookie_manager.get(cookie='authenticated')==True: st.write("Page 0") print("Page 0") else: st.write("Page 1") print("Page 1") if __name__ == "__main__": main()
And got the print log:
cookie_manager: None Page 1 cookie_manager: True Page 0
The web page will show from "Page 1" to "Page 0".
The code:
And got the print log:
The web page will show from "Page 1" to "Page 0".