feat: 顶部右侧内容移除冗余代码,封装为组件
This commit is contained in:
31
src/store/modules/core.ts
Normal file
31
src/store/modules/core.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
/**核心网信息类型 */
|
||||
type Core = {
|
||||
/**当前选择 */
|
||||
current: string;
|
||||
/**核心网选择 */
|
||||
coreOptions: Record<string, any>[];
|
||||
};
|
||||
|
||||
const useCoreStore = defineStore('core', {
|
||||
state: (): Core => ({
|
||||
current: 'Global',
|
||||
coreOptions: [
|
||||
{ label: 'Core', value: 'Core' },
|
||||
{ label: 'Core2', value: 'Core2' },
|
||||
],
|
||||
}),
|
||||
getters: {
|
||||
getCoreOptions(): Record<string, any>[] {
|
||||
return this.coreOptions;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
setCurrent(value: string = 'Global') {
|
||||
this.current = value;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export default useCoreStore;
|
||||
Reference in New Issue
Block a user