dynamic-router-view
v1.0.7
Published
Vue routing dynamic cache scheme
Downloads
14
Readme
dynamic-router-view
Vue routing dynamic cache scheme
install and use
# install dependencies
npm install dynamic-router-view
or
yarn add dynamic-router-view
# 在 main.js 入口文件中
import Vue from 'vue';
import dynamicRouterView from 'dynamic-router-view'
import store from './store';
import router from './router';
# 注册插件
Vue.use(dynamicRouterView, {
router, // 挂载到root的router实例
store, // 挂载到root的store实例
// 缓存路由关系配置
cacheMap: {
listRouterName: ['targetRouterName'] // key: 需要缓存的路由name 如:列表页, value: 跳转目标路由name 如:详情页
}
})
### 重要提示!
### 重要提示!
### 重要提示!
### 使用次插件,页面组件必须配置name,路由也必须配置name, 并且两个name必须保持一直,严格区分大小写!!
# 原生router-view 替换
<router-view/>
替换成
<cache-router-view/>