听海 fc4173a7e8
feat(plugin-layout): 多页签支持配置title (#174)
* feat(plugin-layout): 多页签支持配置title

* feat: 更改参数名 & 关闭页面清数据

* docs: 更新文档

* docs: 更新文档
2023-03-13 20:28:03 +08:00

19 lines
423 B
JavaScript

import { reactive, ref } from 'vue';
import { useRoute } from '@@/core/coreExports';
const cache = reactive(new Map());
export const getTitle = (path) => cache.get(path);
export const deleteTitle = (patch) => cache.delete(patch);
export const useTabTitle = (title) => {
const route = useRoute();
const titleRef = ref(title);
const path = route.path;
cache.set(path, titleRef);
return titleRef;
};