b37f4363eb
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.
31 lines
560 B
TypeScript
31 lines
560 B
TypeScript
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,
|
|
}
|
|
})
|