im.js 801 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { defineStore } from 'pinia'
  2. import { ref } from 'vue'
  3. export const useIMStore = defineStore('IM',
  4. () => {
  5. const uid = ref('')
  6. const connected = ref(false)
  7. const newMsg = ref(0)
  8. const fromChannel = ref('')
  9. const unreadCount = ref(0)
  10. const setConnected = (val) => {
  11. connected.value = val
  12. }
  13. const setUid = (val) => {
  14. uid.value = val
  15. }
  16. const setNewMsg = (val) => {
  17. newMsg.value = val
  18. }
  19. const setFromChannel = (val) => {
  20. fromChannel.value = val
  21. }
  22. const setUnreadCount = (val) => {
  23. unreadCount.value = val
  24. }
  25. return {
  26. connected,
  27. uid,
  28. newMsg,
  29. fromChannel,
  30. unreadCount,
  31. setUnreadCount,
  32. setFromChannel,
  33. setNewMsg,
  34. setUid,
  35. setConnected
  36. }
  37. })