@hostlink/nuxt-light 1.22.0 → 1.22.1

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/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "light",
3
3
  "configKey": "light",
4
- "version": "1.22.0",
4
+ "version": "1.22.1",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.0"
@@ -61,6 +61,8 @@ let my = reactive(tt.my)
61
61
 
62
62
  const light = useLight();
63
63
 
64
+ light.devMode = tt.system.devMode;
65
+
64
66
  light.init(my.styles);
65
67
 
66
68
  //set permission
@@ -281,15 +283,6 @@ const onLogout = async () => {
281
283
  emits('logout');
282
284
  }
283
285
 
284
- watch(light.errors, (value) => {
285
- if (value.length > 0) {
286
- //if errors
287
- for (let error of value) {
288
- console.log(error.message);
289
- }
290
- }
291
- })
292
-
293
286
  </script>
294
287
 
295
288
 
@@ -432,7 +425,7 @@ watch(light.errors, (value) => {
432
425
 
433
426
  <q-page-container :class="containerClass" :style="containerStyle"> <!-- Error message -->
434
427
  <slot name="header"></slot>
435
- <div class="q-gutter-sm q-pa-sm" v-if="$light.errors.length > 0">
428
+ <div class="q-gutter-sm q-pa-sm" v-if="system.devMode && $light.errors.length > 0">
436
429
  <q-banner dense inline-actions class="bg-grey-4" v-for=" error in $light.errors " rounded>
437
430
  {{ error }}
438
431
  <template v-slot:action>
@@ -15,6 +15,7 @@ export interface User {
15
15
  language?: string;
16
16
  }
17
17
  declare const light: {
18
+ devMode: boolean;
18
19
  styles: any;
19
20
  version: string;
20
21
  errors: Array<Error>;
@@ -618,6 +619,7 @@ export declare const createLight: (opts: any) => {
618
619
  install: (app: App) => void;
619
620
  };
620
621
  export declare const useLight: () => {
622
+ devMode: boolean;
621
623
  styles: any;
622
624
  version: string;
623
625
  errors: Array<Error>;
@@ -1,6 +1,6 @@
1
1
  import { useQuasar } from "quasar";
2
2
  import packageJson from "../../package.json";
3
- import { watch, reactive } from "vue";
3
+ import { watch, reactive, getCurrentInstance } from "vue";
4
4
  import { m, q } from "./lib/index.js";
5
5
  const COLOR_CODE = {
6
6
  red: "#f44336",
@@ -32,6 +32,7 @@ const COLOR_CODE = {
32
32
  dark: "#4b4b4b"
33
33
  };
34
34
  const light = reactive({
35
+ devMode: false,
35
36
  styles: {
36
37
  table: {
37
38
  dense: true,
@@ -271,6 +272,8 @@ export const createLight = (opts) => {
271
272
  };
272
273
  let currentRoute = null;
273
274
  export const useLight = () => {
274
- light.$q = useQuasar();
275
+ if (getCurrentInstance()) {
276
+ light.$q = useQuasar();
277
+ }
275
278
  return light;
276
279
  };
@@ -32,8 +32,10 @@ export default defineNuxtPlugin((nuxtApp) => {
32
32
  api.model("SystemValue").setDataPath("app.listSystemValue");
33
33
  api.model("Permission").setDataPath("app.listPermission");
34
34
  nuxtApp.vueApp.config.errorHandler = (err, instance, info) => {
35
- console.log(err);
36
35
  const light = useLight();
36
+ if (light.devMode) {
37
+ console.log(err);
38
+ }
37
39
  if (err instanceof Error) {
38
40
  light.addError(err);
39
41
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "1.22.0",
3
+ "version": "1.22.1",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": {
6
6
  "type": "git",