mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat(projects): 增加设置当前Tab页签名称功能
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
import { unref } from 'vue';
|
||||
import type { Ref } from 'vue';
|
||||
import type { Router, RouteLocationNormalizedLoaded } from 'vue-router';
|
||||
import { defineStore } from 'pinia';
|
||||
import { useRouterPush } from '@/composables';
|
||||
@ -50,6 +52,16 @@ export const useTabStore = defineStore('tab-store', {
|
||||
setActiveTab(fullPath: string) {
|
||||
this.activeTab = fullPath;
|
||||
},
|
||||
/**
|
||||
* 设置当前路由对应的页签title
|
||||
* @param title - tab名称
|
||||
*/
|
||||
setActiveTabTitle(title: string | Ref<string>) {
|
||||
const item = this.tabs.find(tab => tab.fullPath === this.activeTab);
|
||||
if (item) {
|
||||
Object.assign(item, { meta: { title: unref(title) } });
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 初始化首页页签路由
|
||||
* @param routeHomeName - 路由首页的name
|
||||
|
Reference in New Issue
Block a user