mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
style(projects): update prettier config
This commit is contained in:
@ -21,21 +21,21 @@ export const useTabStore = defineStore('tab-store', {
|
||||
name: 'root',
|
||||
path: '/',
|
||||
meta: {
|
||||
title: 'root',
|
||||
title: 'root'
|
||||
},
|
||||
scrollPosition: {
|
||||
left: 0,
|
||||
top: 0,
|
||||
},
|
||||
top: 0
|
||||
}
|
||||
},
|
||||
activeTab: '',
|
||||
activeTab: ''
|
||||
}),
|
||||
getters: {
|
||||
/** 当前激活状态的页签索引 */
|
||||
activeTabIndex(state) {
|
||||
const { tabs, activeTab } = state;
|
||||
return tabs.findIndex((tab) => tab.path === activeTab);
|
||||
},
|
||||
return tabs.findIndex(tab => tab.path === activeTab);
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
/**
|
||||
@ -52,7 +52,7 @@ export const useTabStore = defineStore('tab-store', {
|
||||
*/
|
||||
initHomeTab(routeHomeName: string, router: Router) {
|
||||
const routes = router.getRoutes();
|
||||
const findHome = routes.find((item) => item.name === routeHomeName);
|
||||
const findHome = routes.find(item => item.name === routeHomeName);
|
||||
if (findHome) {
|
||||
this.homeTab = getTabRouteByVueRoute(findHome);
|
||||
}
|
||||
@ -74,7 +74,7 @@ export const useTabStore = defineStore('tab-store', {
|
||||
const { routerPush } = useRouterPush(false);
|
||||
|
||||
const isActive = this.activeTab === path;
|
||||
const updateTabs = this.tabs.filter((tab) => tab.path !== path);
|
||||
const updateTabs = this.tabs.filter(tab => tab.path !== path);
|
||||
this.tabs = updateTabs;
|
||||
if (isActive && updateTabs.length) {
|
||||
const activePath = updateTabs[updateTabs.length - 1].path;
|
||||
@ -92,7 +92,7 @@ export const useTabStore = defineStore('tab-store', {
|
||||
const homePath = this.homeTab.path;
|
||||
const remain = [homePath, ...excludes];
|
||||
const hasActive = remain.includes(this.activeTab);
|
||||
const updateTabs = this.tabs.filter((tab) => remain.includes(tab.path));
|
||||
const updateTabs = this.tabs.filter(tab => remain.includes(tab.path));
|
||||
this.tabs = updateTabs;
|
||||
if (!hasActive && updateTabs.length) {
|
||||
const activePath = updateTabs[updateTabs.length - 1].path;
|
||||
@ -107,7 +107,7 @@ export const useTabStore = defineStore('tab-store', {
|
||||
clearLeftTab(path: string) {
|
||||
const index = getIndexInTabRoutes(this.tabs, path);
|
||||
if (index > -1) {
|
||||
const excludes = this.tabs.slice(index).map((item) => item.path);
|
||||
const excludes = this.tabs.slice(index).map(item => item.path);
|
||||
this.clearTab(excludes);
|
||||
}
|
||||
},
|
||||
@ -118,7 +118,7 @@ export const useTabStore = defineStore('tab-store', {
|
||||
clearRightTab(path: string) {
|
||||
const index = getIndexInTabRoutes(this.tabs, path);
|
||||
if (index > -1) {
|
||||
const excludes = this.tabs.slice(0, index + 1).map((item) => item.path);
|
||||
const excludes = this.tabs.slice(0, index + 1).map(item => item.path);
|
||||
this.clearTab(excludes);
|
||||
}
|
||||
},
|
||||
@ -153,7 +153,7 @@ export const useTabStore = defineStore('tab-store', {
|
||||
getTabScrollPosition(path: string) {
|
||||
const position = {
|
||||
left: 0,
|
||||
top: 0,
|
||||
top: 0
|
||||
};
|
||||
const index = getIndexInTabRoutes(this.tabs, path);
|
||||
if (index > -1) {
|
||||
@ -177,6 +177,6 @@ export const useTabStore = defineStore('tab-store', {
|
||||
}
|
||||
this.tabs = tabs;
|
||||
this.setActiveTab(currentRoute.path);
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user