瀏覽代碼

makes page accept css

Christoph Trappe 3 年之前
父節點
當前提交
01f2b56bdf
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      nicegui/elements/page.py

+ 3 - 3
nicegui/elements/page.py

@@ -5,7 +5,7 @@ from ..globals import config, page_stack, view_stack
 
 class Page(jp.QuasarPage):
 
-    def __init__(self, route: str, title: Optional[str] = None, favicon: Optional[str] = None):
+    def __init__(self, route: str, title: Optional[str] = None, favicon: Optional[str] = None, classes:str ='q-ma-md column items-start', css:str =HtmlFormatter().get_style_defs('.codehilite')):
         """Page
 
         Creates a new page at the given path.
@@ -19,14 +19,14 @@ class Page(jp.QuasarPage):
         self.favicon = favicon or config.favicon
 
         self.tailwind = True  # use Tailwind classes instead of Quasars
-        self.css = HtmlFormatter().get_style_defs('.codehilite')
+        self.css = css
         self.head_html += '''
             <script>
                 confirm = () => { setTimeout(location.reload.bind(location), 100); return false; };
             </script>
         '''  # avoid confirmation dialog for reload
 
-        self.view = jp.Div(a=self, classes='q-ma-md column items-start', style='row-gap: 1em')
+        self.view = jp.Div(a=self, classes=classes, style='row-gap: 1em')
         self.view.add_page(self)
 
         jp.Route(route, lambda: self)