wangzhibo
6 天以前 da0230346106bc810664488a2b152bc24f853a44
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { defineStore } from "pinia";
import { nextTick, ref } from "vue";
 
export const useTools = defineStore("cs.tools", () => {
    // 是否展开
    const isExpand = ref(true);
 
    // 收起、展开
    function expand(value?: boolean) {
        isExpand.value = value === undefined ? !isExpand.value : value;
    }
 
    // 滚动到底部
    async function scrollToBottom() {
        await nextTick();
 
        document.querySelector(".cs-message .el-scrollbar__wrap")?.scroll({
            top: 9999,
            behavior: "smooth"
        });
    }
 
    return {
        isExpand,
        expand,
        scrollToBottom
    };
});