feat: 添加 UI 状态管理,支持新增记录底部弹窗功能,优化设置和主页交互
This commit is contained in:
26
src/stores/ui.js
Normal file
26
src/stores/ui.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
|
||||
// 负责全局 UI 状态,例如新增记录的底部弹窗
|
||||
export const useUiStore = defineStore('ui', () => {
|
||||
const addEntryVisible = ref(false)
|
||||
const editingTransactionId = ref('')
|
||||
|
||||
const openAddEntry = (id = '') => {
|
||||
editingTransactionId.value = id || ''
|
||||
addEntryVisible.value = true
|
||||
}
|
||||
|
||||
const closeAddEntry = () => {
|
||||
addEntryVisible.value = false
|
||||
editingTransactionId.value = ''
|
||||
}
|
||||
|
||||
return {
|
||||
addEntryVisible,
|
||||
editingTransactionId,
|
||||
openAddEntry,
|
||||
closeAddEntry,
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user