gerson
2025-01-21 952977720041f6332e08609f22774a844c725e18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { debounce } from 'lodash-es';
import { ref } from 'vue';
 
export const useChatWidth = () => {
    const chatWidth = ref<string>('75%');
 
    const updateChatWidth = ({ width }) => {
        if (width < 1200) {
            width = '100%';
        } else if (width < 1600) {
            width = '85%';
        } else {
            width = '75%';
        }
        chatWidth.value = width;
    };
 
    const debounceUpdateChatWidth = debounce(updateChatWidth, 100);
 
    return {
        chatWidth,
        updateChatWidth:debounceUpdateChatWidth,
    };
};