<router-view v-slot="{ Component }">
<keep-alive :include="keepaliveList">
<component :is="Component" />
</keep-alive>
</router-view>
export const updateKeepAlive = (pageName = "", type = "add") => {
let storeList =
JSON.parse(JSON.stringify(store.state.crm_customers.keepaliveList)) || [];
if (type == "reset") {
storeList = [];
} else if (type == "del") {
let index = storeList.findIndex((x) => x == pageName);
if (index != -1) {
storeList.splice(index, 1);
}
} else {
let index = storeList.findIndex((x) => x == pageName);
if (index == -1) {
storeList.push(pageName);
}
}
store.dispatch("set_keepaliveList", storeList);
};
这里的名字是组件名,不是路由名
export default {
name: "Hello",
};