| 1234567891011121314151617181920212223 |
- export const useLoadingStore = defineStore('loadingStore', () => {
- // state
- const count = ref(0)
- // getter
- const getCount = computed(() => count.value)
- // action
- function plusCount(){
- console.log('%c 카운트 증가' ,'color:#bada55','')
- count.value++
- }
- function minusCount(){
- console.log('%c 카운트 감소' ,'color:#bada55','')
- setTimeout(() => {
- count.value--
- }, 300)
- }
- function resetCount(){
- count.value = 0
- }
- return { count, getCount, plusCount, minusCount, resetCount }
- })
- // 새로고침시 초기화 되어야하기때문에 해당 plugin 기능 제거
- // , {persist: true}
|