@ -3,9 +3,11 @@
</style>
<template>
<transition name="fade-transform" mode="out-in">
<router-view v-slot="{ Component }" :key="$route.path">
<keep-alive :include="cacheViews">
<router-view :key="$route.path"/>
<component :is="Component"/>
</keep-alive>
</router-view>
</transition>
</template>
<script>
@ -65,13 +65,15 @@ export default defineComponent({
}
onMounted(async ()=>{
if(typeof props.item?.component==='function'){
commit('data/setMenu',{
key:props.basePath,
item:{
name:(await props.item?.component?.())?.default.name,
name:(await props.item.component())?.default?.name,
parentPath:props.item?.meta?.parentPath,
})
return _data;
},
@ -1,18 +1,14 @@
import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '@/layout'
import Home from '../views/Home.vue'
const routes = [
{
path: '/',
name: 'Home',
component: Home
]
export const menu=[
path:"/demo",
path:"/",
component: Layout,
redirect:"/path1",
meta:{
title:"demo",
icon:"atm",