优化
This commit is contained in:
20
src/App.vue
20
src/App.vue
@@ -5,28 +5,36 @@
|
||||
<left-menu />
|
||||
</div>
|
||||
<div :class="{ view: route.path != '/login' }">
|
||||
<router-view />
|
||||
<!-- <div class="wrapper">
|
||||
<div class="wrapper">
|
||||
<div class="animation">
|
||||
<router-view v-slot="{ Component }">
|
||||
<transition :name="transitionName">
|
||||
<!-- <transition :name="transitionName"> -->
|
||||
<keep-alive :include="includeList">
|
||||
<component :is="Component"></component>
|
||||
</transition>
|
||||
</keep-alive>
|
||||
<!-- </transition> -->
|
||||
</router-view>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-config-provider>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { ref, reactive, watch } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router"
|
||||
import leftMenu from '@/components/leftMenu.vue'
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const includeList = reactive([]);
|
||||
watch(route, (to) => {
|
||||
if (to.meta.keepAlive) {
|
||||
includeList.push(to.name);
|
||||
}
|
||||
});
|
||||
|
||||
let transitionName = ref();
|
||||
let router = useRouter();
|
||||
router.beforeEach((to, from) => {
|
||||
|
||||
Reference in New Issue
Block a user