x-essential-lib 0.10.18 → 0.10.20

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.
Files changed (2) hide show
  1. package/dist/index.js +18 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -517,36 +517,42 @@ const routeMetas = [
517
517
  {
518
518
  app: "x-mine-mf",
519
519
  path: "/mine/personalInfo",
520
+ back: "/mine",
520
521
  level: 1,
521
522
  requireAuth: true
522
523
  },
523
524
  {
524
525
  app: "x-mine-mf",
525
526
  path: "/mine/settings",
527
+ back: "/mine",
526
528
  level: 1,
527
529
  requireAuth: true
528
530
  },
529
531
  {
530
532
  app: "x-mine-mf",
531
533
  path: "/mine/accountSecurity",
534
+ back: "/mine/settings",
532
535
  level: 2,
533
536
  requireAuth: true
534
537
  },
535
538
  {
536
539
  app: "x-mine-mf",
537
540
  path: "/mine/general",
541
+ back: "/mine/settings",
538
542
  level: 2,
539
543
  requireAuth: true
540
544
  },
541
545
  {
542
546
  app: "x-mine-mf",
543
547
  path: "/mine/darkMode",
548
+ back: "/mine/general",
544
549
  level: 3,
545
550
  requireAuth: true
546
551
  },
547
552
  {
548
553
  app: "x-mine-mf",
549
554
  path: "/mine/language",
555
+ back: "/mine/general",
550
556
  level: 3,
551
557
  requireAuth: true
552
558
  },
@@ -792,7 +798,7 @@ function useMicroApp(globalStates, base, customBack) {
792
798
  running.value = true;
793
799
  }
794
800
  async function onBackButton() {
795
- await handleBack();
801
+ eventBus.emit("back");
796
802
  }
797
803
  function onDeviceReady() {
798
804
  console.log("onDeviceReady");
@@ -859,11 +865,15 @@ function useMicroApp(globalStates, base, customBack) {
859
865
  if (!routeMeta) return;
860
866
  if (routeMeta.level === 0) navigator?.Backbutton?.goHome(() => {}, () => {});
861
867
  else if (customBack) customBack(routeMeta);
862
- else if (routeMeta.back) router.replace({
863
- path: routeMeta.back,
864
- query: { orgId: activeOrg.value }
865
- });
866
- else router.back();
868
+ else {
869
+ let back;
870
+ if (route.query.back) back = route.query.back;
871
+ else if (routeMeta.back) back = routeMeta.back;
872
+ if (back) router.replace({
873
+ path: back,
874
+ query: { orgId: activeOrg.value }
875
+ });
876
+ }
867
877
  }
868
878
  async function onKeyDown(e) {
869
879
  if (e.key === "Escape") {
@@ -874,9 +884,11 @@ function useMicroApp(globalStates, base, customBack) {
874
884
  if (!base) {
875
885
  onMounted(() => {
876
886
  window.addEventListener("keydown", onKeyDown);
887
+ eventBus.on("back", handleBack);
877
888
  });
878
889
  onBeforeUnmount(() => {
879
890
  window.removeEventListener("keydown", onKeyDown);
891
+ eventBus.off("back", handleBack);
880
892
  });
881
893
  }
882
894
  function onUpdateDark(val) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x-essential-lib",
3
- "version": "0.10.18",
3
+ "version": "0.10.20",
4
4
  "files": [
5
5
  "dist"
6
6
  ],