shared-ritm 1.0.73 → 1.0.75

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.
@@ -0,0 +1,2 @@
1
+ declare const router: import("vue-router").Router;
2
+ export default router;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shared-ritm",
3
- "version": "1.0.73",
3
+ "version": "1.0.75",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",
@@ -31,7 +31,8 @@
31
31
  "@vueuse/core": "^10.1.2",
32
32
  "axios": "^1.7.7",
33
33
  "quasar": "^2.17.1",
34
- "vue": "^3.5.12"
34
+ "vue": "^3.5.12",
35
+ "vue-router": "^4.0.3"
35
36
  },
36
37
  "devDependencies": {
37
38
  "@quasar/vite-plugin": "^1.8.0",
@@ -45,7 +45,7 @@
45
45
  <q-tooltip>Закрепить сайдбар</q-tooltip>
46
46
  </q-btn>
47
47
  </template>
48
- <sidebar-menu :menu-items="menuItems" :minify="isSidebarMini" />
48
+ <sidebar-menu :main="main" :menu-items="menuItems" :minify="isSidebarMini" />
49
49
  <q-item v-ripple :class="$style['menu-exit']" clickable @click="logout()">
50
50
  <q-item-section avatar>
51
51
  <app-icon :name="'logout-icon'" color="white" size="24px" />
@@ -56,7 +56,7 @@
56
56
  </template>
57
57
 
58
58
  <script setup lang="ts">
59
- import { computed, defineProps, defineEmits, ref, watch } from 'vue'
59
+ import { computed, defineProps, defineEmits, ref, watch, withDefaults } from 'vue'
60
60
  import SidebarMenu from './components/SidebarMenu.vue'
61
61
 
62
62
  import { useQuasar } from 'quasar'
@@ -66,9 +66,12 @@ interface Props {
66
66
  isDrawer: boolean
67
67
  minify?: boolean
68
68
  menuItems?: any[]
69
+ main?: boolean
69
70
  }
70
71
  const emits = defineEmits(['logout'])
71
- const props = defineProps<Props>()
72
+ const props = withDefaults(defineProps<Props>(), {
73
+ main: false,
74
+ })
72
75
  const $q = useQuasar()
73
76
 
74
77
  const drawer = ref(true)
@@ -1,17 +1,33 @@
1
1
  <template>
2
2
  <div :class="$style.wrapper">
3
- <sidebar-menu-item v-for="(item, index) in menuItems" :key="index" :item="item" :minify="minify" />
3
+ <sidebar-menu-item
4
+ v-for="(item, index) in menuItems"
5
+ :key="index"
6
+ :item="item"
7
+ :minify="minify"
8
+ @go-to-route="goToRoute"
9
+ />
4
10
  </div>
5
11
  </template>
6
12
 
7
13
  <script lang="ts" setup>
8
14
  import { defineProps } from 'vue'
9
15
  import SidebarMenuItem from './SidebarMenuItem.vue'
16
+ import { useRouter } from 'vue-router'
10
17
 
11
18
  interface Props {
12
19
  menuItems?: any[]
13
20
  minify?: boolean
21
+ main: boolean
14
22
  }
23
+
24
+ const router = useRouter()
25
+
26
+ const goToRoute = (to: string) => {
27
+ if (!props.main) window.location.href = to
28
+ router.push(to)
29
+ }
30
+
15
31
  const props = defineProps<Props>()
16
32
  </script>
17
33
 
@@ -33,7 +33,7 @@
33
33
  :active="isRouteActive(item)"
34
34
  active-class="menu-active"
35
35
  clickable
36
- :to="item.to"
36
+ @click="emits('goToRoute', item.to)"
37
37
  >
38
38
  <q-tooltip
39
39
  v-if="minify"
@@ -70,16 +70,13 @@ interface Props {
70
70
  }
71
71
  }
72
72
 
73
+ const emits = defineEmits(['goToRoute'])
73
74
  const props = defineProps<Props>()
74
75
 
75
76
  const test = reactive({
76
77
  'repairs-icon': true,
77
78
  })
78
79
 
79
- const goToRoute = (item: any) => {
80
- window.location.href = item.to
81
- }
82
-
83
80
  const isRouteActive = (item: any) => {
84
81
  return (item.to === '' && item.items.find((x: any) => x.to === '/repairs/')) || item.to === '/repairs/'
85
82
  }
package/src/main.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createApp } from 'vue'
2
2
  import { Quasar } from 'quasar'
3
-
3
+ import router from './router'
4
4
  import '@quasar/extras/material-icons/material-icons.css'
5
5
  import 'quasar/src/css/index.sass'
6
6
 
@@ -12,4 +12,5 @@ const app = createApp(App)
12
12
 
13
13
  //@ts-ignore
14
14
  app.use(Quasar, { plugins: [] })
15
+ app.use(router)
15
16
  app.mount('#app')
@@ -0,0 +1,10 @@
1
+ import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
2
+
3
+ const routes: RouteRecordRaw[] = []
4
+
5
+ const router = createRouter({
6
+ history: createWebHistory(),
7
+ routes,
8
+ })
9
+
10
+ export default router