feat: open_browser bool attribute
This commit is contained in:
1 parent
5233ee97d9
commit
9e04ce5342
2 files changed
+10
-4
No files matched your search
@@ -16,6 +16,7 @@ fn app(cx: Scope) -> Element {
|
||||
p {
|
||||
a {
|
||||
href: "http://dioxuslabs.com/",
|
||||
"browser-open": "false",
|
||||
onclick: |_| {
|
||||
println!("Hello Dioxus");
|
||||
},
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user