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 {
|
p {
|
||||||
a {
|
a {
|
||||||
href: "http://dioxuslabs.com/",
|
href: "http://dioxuslabs.com/",
|
||||||
|
"browser-open": "false",
|
||||||
onclick: |_| {
|
onclick: |_| {
|
||||||
println!("Hello Dioxus");
|
println!("Hello Dioxus");
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -414,10 +414,15 @@ class Interpreter {
|
|||||||
const target = event.target;
|
const target = event.target;
|
||||||
const real_id = target.getAttribute(`dioxus-id`);
|
const real_id = target.getAttribute(`dioxus-id`);
|
||||||
|
|
||||||
rpc.call("browser_open", {
|
if (target.getAttribute("browser-open") != "false") {
|
||||||
mounted_dom_id: parseInt(real_id),
|
rpc.call("browser_open", {
|
||||||
href: target.getAttribute("browser-href"),
|
mounted_dom_id: parseInt(real_id),
|
||||||
})
|
href: target.getAttribute("browser-href"),
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
window.location = target.getAttribute("browser-href");
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in new issue
Block a user