cradova 3.3.10 → 3.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +12 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -124,7 +124,7 @@ var makeElement = (element, ElementChildrenAndPropertyList) => {
|
|
|
124
124
|
if (!href.includes("://")) {
|
|
125
125
|
element.addEventListener("click", (e) => {
|
|
126
126
|
e.preventDefault();
|
|
127
|
-
Router.navigate(element.
|
|
127
|
+
Router.navigate(element.href);
|
|
128
128
|
if (href.includes("#")) {
|
|
129
129
|
const l = href.split("#").at(-1);
|
|
130
130
|
document.getElementById("#" + l)?.scrollIntoView();
|
|
@@ -621,7 +621,7 @@ class RouterBoxClass {
|
|
|
621
621
|
return;
|
|
622
622
|
}
|
|
623
623
|
async router(_e, _force) {
|
|
624
|
-
let url = window.location.
|
|
624
|
+
let url = window.location.href, route, params;
|
|
625
625
|
if (this.paused) {
|
|
626
626
|
window.location.hash = "paused";
|
|
627
627
|
return;
|
|
@@ -682,17 +682,16 @@ class RouterBoxClass {
|
|
|
682
682
|
if (this.routes[url]) {
|
|
683
683
|
return [this.routes[url], { path: url }];
|
|
684
684
|
}
|
|
685
|
-
if (
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
685
|
+
if (url.includes("?")) {
|
|
686
|
+
let search;
|
|
687
|
+
const params = {};
|
|
688
|
+
[url, search] = url.split("?");
|
|
689
|
+
new URLSearchParams(search).forEach((val, key) => {
|
|
690
|
+
params[key] = val;
|
|
691
|
+
});
|
|
692
|
+
if (this.routes[url]) {
|
|
693
|
+
return [this.routes[url], { data: params, path: url }];
|
|
693
694
|
}
|
|
694
|
-
const path = url.slice(0, url.indexOf("/?") + 2);
|
|
695
|
-
return [this.routes[path], { path, search }];
|
|
696
695
|
}
|
|
697
696
|
for (const path in this.routes) {
|
|
698
697
|
if (path.includes(":")) {
|
|
@@ -774,7 +773,7 @@ class Router {
|
|
|
774
773
|
if (href.includes(".")) {
|
|
775
774
|
window.location.href = href;
|
|
776
775
|
} else {
|
|
777
|
-
if (href === window.location.
|
|
776
|
+
if (href === window.location.href) {
|
|
778
777
|
return;
|
|
779
778
|
}
|
|
780
779
|
[route, params] = RouterBox.checker(href);
|