feat: 移动端功能优化 (#132)

* feat: 移动端双击返回顶部

* feat: 深色模式下的底色

* feat: 移动端标题返回顶部和返回底部
This commit is contained in:
Redon
2023-02-26 10:07:02 +08:00
committed by GitHub
parent 1406292405
commit 90f6989445
4 changed files with 58 additions and 12 deletions

View File

@@ -6,6 +6,13 @@ export const useChatStore = defineStore('chat-store', {
state: (): Chat.ChatState => getLocalState(),
getters: {
getChatHistoryByCurrentActive(state: Chat.ChatState) {
const index = state.history.findIndex(item => item.uuid === state.active)
if (index !== -1)
return state.history[index]
return null
},
getChatByUuid(state: Chat.ChatState) {
return (uuid?: number) => {
if (uuid)
@@ -68,6 +75,18 @@ export const useChatStore = defineStore('chat-store', {
return await this.reloadRoute(uuid)
},
getChatByUuidAndIndex(uuid: number, index: number) {
if (!uuid || uuid === 0) {
if (this.chat.length)
return this.chat[0].data[index]
return null
}
const chatIndex = this.chat.findIndex(item => item.uuid === uuid)
if (chatIndex !== -1)
return this.chat[chatIndex].data[index]
return null
},
addChatByUuid(uuid: number, chat: Chat.Chat) {
if (!uuid || uuid === 0) {
if (this.history.length === 0) {