Files
Enterprise-Knowledge-Base/frontend/src/stores/menu.ts
T
wizardchen 56eb2bce33 init commit
2025-08-05 15:08:07 +08:00

47 lines
1.3 KiB
TypeScript

import { ref, computed, reactive } from 'vue'
import { defineStore } from 'pinia';
export const useMenuStore = defineStore('menuStore', {
state: () => ({
menuArr: reactive([
{ title: '知识库', icon: 'zhishiku', path: 'knowledgeBase' },
{
title: '对话',
icon: 'prefixIcon',
path: 'creatChat',
childrenPath: 'chat',
children: reactive<object[]>([]),
},
{ title: '系统设置', icon: 'setting', path: 'settings' }
]),
isFirstSession: false,
firstQuery: ''
}
),
actions: {
updatemenuArr(obj: any) {
this.menuArr[1].children?.push(obj);
},
updataMenuChildren(item: object) {
this.menuArr[1].children?.unshift(item)
},
updatasessionTitle(session_id: string, title: string) {
this.menuArr[1].children?.forEach(item => {
if (item.id == session_id) {
item.title = title;
item.isNoTitle = false;
}
});
},
changeIsFirstSession(payload: boolean) {
this.isFirstSession = payload;
},
changeFirstQuery(payload: string) {
this.firstQuery = payload;
}
}
});