feat(stores): add Pinia domain stores and update docs
Implement concrete Pinia stores for app UI and domain data instead of placeholder re-exports, including seeded student records and snackbar state. Refresh README guidance for components, plugins, and services to document the current project structure, data flow, and usage conventions.feat(stores): add Pinia domain stores and update docs Implement concrete Pinia stores for app UI and domain data instead of placeholder re-exports, including seeded student records and snackbar state. Refresh README guidance for components, plugins, and services to document the current project structure, data flow, and usage conventions.
This commit is contained in:
+30
-1
@@ -1 +1,30 @@
|
||||
export * from './stores/messages'
|
||||
import { defineStore } from 'pinia'
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
export const useMessageStore = defineStore('messages', () => {
|
||||
const openState = ref(false)
|
||||
|
||||
// 開啟訊息中心 Dialog
|
||||
const open = () => {
|
||||
openState.value = true
|
||||
}
|
||||
|
||||
// 關閉訊息中心 Dialog
|
||||
const close = () => {
|
||||
openState.value = false
|
||||
}
|
||||
|
||||
// 提供 v-model 綁定用的 computed
|
||||
const isOpen = computed({
|
||||
get: () => openState.value,
|
||||
set: (value) => {
|
||||
openState.value = value
|
||||
},
|
||||
})
|
||||
|
||||
return {
|
||||
isOpen,
|
||||
open,
|
||||
close,
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user