useSider.ts 438 字节
Newer Older
L
LeoKu 已提交
1 2 3 4 5 6 7 8
import { computed } from 'vue'

import { useStore } from '@/store'
import { SET_SIDER_STATUS } from '@/store/mutation-type'

export default function useSider() {
  const store = useStore()

9
  const isCollapsed = computed(() => store.isSiderCollapsed)
L
LeoKu 已提交
10 11

  const openSider = () => {
12
    store[SET_SIDER_STATUS](false)
L
LeoKu 已提交
13 14 15
  }

  const closeSider = () => {
16
    store[SET_SIDER_STATUS](true)
L
LeoKu 已提交
17 18 19 20
  }

  return { isCollapsed, openSider, closeSider }
}