项目会使用tab功能,进而需要对页面数据进行缓存。在本地开发的时候,能够正常缓存,但是在使用webpack打包后,上传至服务器发现缓存失效,导致有些业务出错。路由代码:module.exports = (file: string) => { 'use strict'; return () => import(`@/views/${file}`);
};const getComponent = require(`./import_${process.env.NODE_ENV}`);
{
path: '/customers',
name: 'Customers',
component: getComponent('customers/index'),
permission: true,
meta: { key: 'Customers' },
children: [
{
path: 'baseInfo',
name: 'Base Info',
component: getComponent('customers/baseInfo/index'),
permission: true,
meta: { key: 'BaseInfo' },
},
],
},页面代码:import { Component, Vue } from 'vue-property-decorator';@Componentexport default class Components extends Vue {
render() {
const { keepList } = this.$store.state.app; return (
<keep-alive max={10} include={keepList}>
<router-view />
</keep-alive>
);
}
}
添加回答
举报
0/150
提交
取消