1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| import { computed, ref, watch } from 'vue';
| import type { ChatRoomItem } from '../layout/component/sidebar/waterLeftAside/types';
| import { Local } from '../utils/storage';
|
| export const chatRoomList = ref<ChatRoomItem[]>(Local.get('chatRoomList'));
|
| watch(
| () => chatRoomList.value,
| (val) => {
| Local.set('chatRoomList', val);
| },
| {
| deep: true,
| }
| );
|
| export const activeRoomId = ref(null);
| export const activeChatRoom = computed(() => chatRoomList.value?.find((item) => item.id === activeRoomId.value));
|
|