浏览代码

Merge branch 'main' of github.com:zauberzeug/nicegui

Rodja Trappe 3 年之前
父节点
当前提交
73b27f613b
共有 2 个文件被更改,包括 6 次插入2 次删除
  1. 5 1
      nicegui/nicegui.py
  2. 1 1
      nicegui/static/templates/js/event_handler.js

+ 5 - 1
nicegui/nicegui.py

@@ -11,7 +11,11 @@ from .timer import Timer
 wp = jp.QuasarPage(delete_flag=False, title=Ui.config.title, favicon=Ui.config.favicon)
 wp.tailwind = True  # use Tailwind classes instead of Quasars
 wp.css = HtmlFormatter().get_style_defs('.codehilite')
-wp.head_html += '<script>confirm = () => true;</script>\n'  # avoid confirmation dialog for reload
+wp.head_html += '''
+    <script>
+        confirm = () => { setTimeout(location.reload.bind(location), 100); return false; };
+    </script>
+'''  # avoid confirmation dialog for reload
 
 main = jp.Div(a=wp, classes='q-ma-md column items-start', style='row-gap: 1em')
 main.add_page(wp)

+ 1 - 1
nicegui/static/templates/js/event_handler.js

@@ -174,4 +174,4 @@ function send_to_server(e, event_type, debug_flag) {
     }
 }
 
-// {% endraw %}
+// {% endraw %}