x-essential-lib 0.10.9 → 0.10.10
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.d.ts +1 -1
- package/dist/index.js +17 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -310,7 +310,7 @@ interface States {
|
|
|
310
310
|
lastAppPath: Ref<string>;
|
|
311
311
|
views: Ref<string[]>;
|
|
312
312
|
}
|
|
313
|
-
declare function useMicroApp(states: States, customBack?: (m: RouteMeta) => void): void;
|
|
313
|
+
declare function useMicroApp(states: States, syncLocale: () => Promise<void>, customBack?: (m: RouteMeta) => void): void;
|
|
314
314
|
//#endregion
|
|
315
315
|
//#region src/composables/permission.d.ts
|
|
316
316
|
declare function usePermission(): {
|
package/dist/index.js
CHANGED
|
@@ -731,7 +731,7 @@ function clearViews(views) {
|
|
|
731
731
|
|
|
732
732
|
//#endregion
|
|
733
733
|
//#region src/composables/microApp.ts
|
|
734
|
-
function useMicroApp(states, customBack) {
|
|
734
|
+
function useMicroApp(states, syncLocale, customBack) {
|
|
735
735
|
const route = useRoute();
|
|
736
736
|
const router = useRouter();
|
|
737
737
|
const { dark, locale, activeOrg, permissionObjects, permissionChecksum, lastAppPath, views } = states;
|
|
@@ -743,6 +743,20 @@ function useMicroApp(states, customBack) {
|
|
|
743
743
|
else d = prefDark.value;
|
|
744
744
|
finalDark.value = d;
|
|
745
745
|
});
|
|
746
|
+
const theme = useTheme();
|
|
747
|
+
watchEffect(async () => {
|
|
748
|
+
await theme.change(finalDark.value ? "dark" : "light");
|
|
749
|
+
});
|
|
750
|
+
let pending = true;
|
|
751
|
+
router.beforeEach(async (to, from) => {
|
|
752
|
+
await syncLocale();
|
|
753
|
+
pending = false;
|
|
754
|
+
return onBeforeEach(to, from, lastAppPath.value);
|
|
755
|
+
});
|
|
756
|
+
watch(locale, async () => {
|
|
757
|
+
if (pending) return;
|
|
758
|
+
await syncLocale();
|
|
759
|
+
});
|
|
746
760
|
provideDark(finalDark);
|
|
747
761
|
provideLocale(locale);
|
|
748
762
|
provideActiveOrg(activeOrg);
|
|
@@ -750,10 +764,6 @@ function useMicroApp(states, customBack) {
|
|
|
750
764
|
providePermissionChecksum(permissionChecksum);
|
|
751
765
|
provideLastAppPath(lastAppPath);
|
|
752
766
|
provideViews(views);
|
|
753
|
-
const theme = useTheme();
|
|
754
|
-
watchEffect(async () => {
|
|
755
|
-
await theme.change(finalDark.value ? "dark" : "light");
|
|
756
|
-
});
|
|
757
767
|
async function handleBack() {
|
|
758
768
|
if (!isEmpty(views)) {
|
|
759
769
|
if (!hasView(views, "waitDlg")) popView(views);
|
|
@@ -792,9 +802,8 @@ function useMicroApp(states, customBack) {
|
|
|
792
802
|
activeOrg.value = val;
|
|
793
803
|
}
|
|
794
804
|
function onUpdatePermission(val) {
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
permissionChecksum.value = v[1];
|
|
805
|
+
permissionObjects.value = val[0];
|
|
806
|
+
permissionChecksum.value = val[1];
|
|
798
807
|
}
|
|
799
808
|
function onUpdateLastAppPath(val) {
|
|
800
809
|
lastAppPath.value = val;
|