Lista Città (prese dal server: pickup)
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { IListRoutes } from '@src/model'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { computed, defineComponent, watch } from 'vue'
|
||||
import { computed, defineComponent, ref, watch } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { static_data } from '@/db/static_data'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'MenuOne',
|
||||
@@ -17,12 +18,17 @@ export default defineComponent({
|
||||
|
||||
setup(props) {
|
||||
const route = useRoute()
|
||||
const userStore = useUserStore()
|
||||
const globalStore = useGlobalStore()
|
||||
|
||||
const finishLoading = computed(() => globalStore.finishLoading)
|
||||
|
||||
const path = computed(() => route.path)
|
||||
|
||||
const getroutes = computed(() => static_data.routes)
|
||||
|
||||
const myroutes = ref(<IListRoutes[]>[])
|
||||
|
||||
function getmenu(): any {
|
||||
// console.log('getmenu menuOne!')
|
||||
return globalStore.getmenu
|
||||
@@ -36,7 +42,12 @@ export default defineComponent({
|
||||
})
|
||||
}
|
||||
|
||||
watch(path, (to: string, from: string) => {
|
||||
watch(() => userStore.isLogged,(to, from) => {
|
||||
myroutes.value = []
|
||||
myroutes.value = static_data.routes
|
||||
})
|
||||
|
||||
watch(() => path, (to, from) => {
|
||||
const mymenu = globalStore.getmenu
|
||||
// console.log('watch:', mymenu)
|
||||
Object.keys(mymenu).forEach((parentName: any) => {
|
||||
@@ -80,6 +91,8 @@ export default defineComponent({
|
||||
return menu
|
||||
}
|
||||
|
||||
myroutes.value = static_data.routes
|
||||
|
||||
return {
|
||||
getmenu,
|
||||
finishLoading,
|
||||
@@ -87,6 +100,8 @@ export default defineComponent({
|
||||
getroute,
|
||||
static_data,
|
||||
tools,
|
||||
getroutes,
|
||||
myroutes,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<q-list class="rounded-borders text-primary">
|
||||
<div v-for="ind1 in getmenu()" :key="ind1">
|
||||
<!--<div class="q-list-header">{{replaceUnderlineToSpace(index)}}</div>-->
|
||||
<div v-for="(myitemmenu, ind2) in static_data.routes" :key="ind2">
|
||||
<div v-for="(myitemmenu, ind2) in myroutes" :key="ind2">
|
||||
<div v-if="myitemmenu.active">
|
||||
<div v-if="myitemmenu.routes2 && myitemmenu.inmenu && tools.visumenu(myitemmenu)">
|
||||
|
||||
|
||||
Reference in New Issue
Block a user