loading.js 639 B

1234567891011121314151617181920212223
  1. export const useLoadingStore = defineStore('loadingStore', () => {
  2. // state
  3. const count = ref(0)
  4. // getter
  5. const getCount = computed(() => count.value)
  6. // action
  7. function plusCount(){
  8. console.log('%c 카운트 증가' ,'color:#bada55','')
  9. count.value++
  10. }
  11. function minusCount(){
  12. console.log('%c 카운트 감소' ,'color:#bada55','')
  13. setTimeout(() => {
  14. count.value--
  15. }, 300)
  16. }
  17. function resetCount(){
  18. count.value = 0
  19. }
  20. return { count, getCount, plusCount, minusCount, resetCount }
  21. })
  22. // 새로고침시 초기화 되어야하기때문에 해당 plugin 기능 제거
  23. // , {persist: true}