浏览代码

form prevent_default

JtotheThree 3 年之前
父节点
当前提交
45ebcf6f0e
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      packages/html/src/elements.rs

+ 7 - 1
packages/html/src/elements.rs

@@ -1047,7 +1047,7 @@ impl input {
     /// - `text`
     /// - `time`
     /// - `url`
-    /// - `week`    
+    /// - `week`
     pub fn r#type<'a>(&self, cx: NodeFactory<'a>, val: Arguments) -> Attribute<'a> {
         cx.attr("type", val, None, false)
     }
@@ -1106,6 +1106,12 @@ impl a {
     }
 }
 
+impl form {
+    pub fn prevent_default<'a>(&self, cx: NodeFactory<'a>, val: Arguments) -> Attribute<'a> {
+        cx.attr("dioxus-prevent-default", val, None, false)
+    }
+}
+
 builder_constructors! {
     // SVG components
     /// Build a