瀏覽代碼

ability to dismiss notifications

Rodja Trappe 1 年之前
父節點
當前提交
c2c3fc9b8d
共有 2 個文件被更改,包括 9 次插入0 次删除
  1. 5 0
      nicegui/elements/notification.js
  2. 4 0
      nicegui/elements/notification.py

+ 5 - 0
nicegui/elements/notification.js

@@ -5,6 +5,11 @@ export default {
   updated() {
     this.notification(this.options);
   },
+  methods: {
+    async dismiss() {
+      this.notification();
+    },
+  },
   props: {
     options: Object,
   },

+ 4 - 0
nicegui/elements/notification.py

@@ -163,3 +163,7 @@ class Notification(Element, component='notification.js'):
     def close_button(self, value: Union[bool, str]) -> None:
         self._props['options']['closeBtn'] = value
         self.update()
+
+    def dismiss(self) -> None:
+        """Dismiss the notification."""
+        self.run_method('dismiss')