feat: open_browser bool attribute

This commit is contained in:
YuKun Liu committed 2022-01-18 09:32:27 +08:00
1 parent 5233ee97d9
commit 9e04ce5342
2 files changed
+10 -4

No files matched your search

+1
View File
@@ -16,6 +16,7 @@ fn app(cx: Scope) -> Element {
p {
a {
href: "http://dioxuslabs.com/",
"browser-open": "false",
onclick: |_| {
println!("Hello Dioxus");
},
+9 -4
View File
@@ -414,10 +414,15 @@ class Interpreter {
const target = event.target;
const real_id = target.getAttribute(`dioxus-id`);
rpc.call("browser_open", {
mounted_dom_id: parseInt(real_id),
href: target.getAttribute("browser-href"),
})
if (target.getAttribute("browser-open") != "false") {
rpc.call("browser_open", {
mounted_dom_id: parseInt(real_id),
href: target.getAttribute("browser-href"),
});
} else {
window.location = target.getAttribute("browser-href");
}
})
} else {