Merge pull request #29 from bufanyun/v2.0

增加tabsView关闭信号
This commit is contained in:
maxbad 2023-06-16 09:54:06 +08:00 committed by GitHub
commit 99dccef03f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View File

@ -497,6 +497,16 @@
observer.listenTo(navWrap.value, handleResize);
}
watch(
() => tabsViewStore.signal,
(key) => {
if (key != '') {
closeHandleSelect(key);
tabsViewStore.closeSignal('');
}
}
);
return {
...toRefs(state),
navWrap,

View File

@ -16,6 +16,7 @@ export type RouteItem = Partial<RouteLocationNormalized> & {
export type ITabsViewState = {
tabsList: RouteItem[]; // 标签页
signal: string; // 关闭信号
};
//保留固定路由
@ -27,6 +28,7 @@ export const useTabsViewStore = defineStore({
id: 'app-tabs-view',
state: (): ITabsViewState => ({
tabsList: [],
signal: '',
}),
getters: {},
actions: {
@ -69,5 +71,9 @@ export const useTabsViewStore = defineStore({
console.log(retainAffixRoute(this.tabsList));
this.tabsList = retainAffixRoute(this.tabsList);
},
closeSignal(signal: string) {
// 设置tab关闭信号 1刷新 2关闭当前 3关闭其他 4关闭全部
this.signal = signal;
},
},
});