网上找了一大堆,屁用都没有,自己琢磨了一下简单的要死.
如果你用的是若依框架的话,直接打开src/api/router/index.js路由配置项
比如,我的html是这样的
<template slot-scope="scope" >
<router-link :to="'/system/sale-saleDetail/index/' + scope.row.id" class="link-type" >
<span>{{ scope.row.userMobile }}</span>
</router-link>
</template>
我是要跳转到/system/sale-saleDetail/index/+ id参数
那我的路由设置是这样的:
export const dynamicRoutes = [
{
path: '/system/sale-saleDetail',
component: Layout,
hidden: true,
permissions: ['system:sale:list'],
children: [
{
path: 'index/:id(\\d+)',
component: () => import('@/views/system/sale/saleDetail'),
name: 'SaleDetail',
meta: { title: '销售订单审核数据',noCache: true , activeMenu: '/system/sale' }
}
]
},]
注意到这个noCache: true
参数了没?只要是true就可以每次跳转都刷新缓存了,默认是false.
网上搞得那些方法没一个有用的,浪费时间啊!.
附一个参数配置:
那有的朋友问了,我菜单不刷新,这里也没有能配置的地方怎么办?
看样子是写代码写晕了,只需要前端的菜单设置配置一下不缓存就好了(若依框架)