vue iframe {keepAlive}设置不刷新
Router.js中
import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/login/login.vue'
import Register from '../views/register/register.vue'
import Home from '../views/home/home.vue'
import Welcome from '../components/welcome.vue'
import Vaccinemanagement from '../views/vaccinemanagement/vaccinemanagement.vue'
import Bookingmanagement from '../views/bookingmanagement/bookingmanagement.vue'
import Inoculationmanagement from '../views/inoculationmanagement/inoculationmanagement.vue'
import Personalcenter from '../views/personalcenter/personalcenter.vue'
import Usermanagement from '../views/usermanagement/usermanagement.vue'
import Vaccinereservation from '../views/vaccinereservation/vaccinereservation.vue'
import Myreservation from '../views/myreservation/myreservation.vue'
Vue.use(VueRouter)
const routes = [
{
path: '/',
redirect: '/login'
},
{
path: '/login',
meta: {
showMenu: false,
title: '登录',
notCache: true,
},
component: Login
},
{
path: '/register',
component: Register
},
{
path: '/home',
component: Home,
redirect: '/Welcome',
meta: {
showMenu: false,
title: '首页',
notCache: true,
icon: 'el-icon-house',
},
children: [{
path: '/Welcome',
meta: {
showMenu: true,
title: '首页',
icon: 'el-icon-house',
showIframe:true,
},
component: Welcome,
},
{
path: '/vaccinemanagement',
meta: {
showMenu: true,
title: '疫苗信息管理',
notCache: true,
icon: 'el-icon-s-operation',
},
component: Vaccinemanagement
},
{
path: '/bookingmanagement',
meta: {
showMenu: true,
title: '预约信息管理',
notCache: true,
icon: 'el-icon-document-add',
},
component: Bookingmanagement
},
{
path: '/myreservation',
meta: {
showMenu: true,
title: '我的预约',
notCache: true,
icon: 'el-icon-date',
},
component: Myreservation
},
{
path: '/inoculationmanagement',
meta: {
showMenu: true,
title: '接种记录管理',
notCache: true,
icon: 'el-icon-document',
},
component: Inoculationmanagement
},
{
path: '/vaccinereservation',
meta: {
showMenu: true,
title: '新增预约',
notCache: true,
icon: 'el-icon-circle-plus',
},
component: Vaccinereservation
},
{
path: '/personalcenter',
meta: {
showMenu: true,
title: '个人中心',
notCache: true,
icon: 'el-icon-user',
},
component: Personalcenter
},
{
path: '/usermanagement',
meta: {
showMenu: true,
title: '用户管理',
notCache: true,
icon: 'el-icon-setting',
},
component: Usermanagement
},
],
},
]
const router = new VueRouter({
routes
})
export default router
export { routes }
<template>
<div class="home">
<el-container>
<el-header>
<div>
<img src="" alt="">
<span>疫苗预约系系统</span>
</div>
<el-button type="info" @click="logout">退出</el-button>
</el-header>
<el-container>
<!-- 左侧菜单 -->
<el-aside width="200px">
<menu-form></menu-form>
</el-aside>
<!-- 右侧内容 -->
<el-main>
<bread-crumb></bread-crumb>
<!-- 路由占位符 -->
<router-view></router-view>
<iframe src="static/homchart.html" v-show="$route.meta.showIframe" class="iframeCard"></iframe>
</el-main>
</el-container>
</el-container>
</div>
</template>