import { ref } from 'vue';
import { useAsRouter } from './useAsRouter'
import { store } from '@/store'
import { message } from 'ant-design-vue';

export const useMenu = () => {
	const { routerTo, routerCur, routerArrayCur } = useAsRouter();
	
	const openSubMenu = ref<string[]>([]);
	const menuList = ref<object[]>(store.state.permissions.menuList);

	// 点击菜单获取路由
	const onMenu = (path) => {
		routerTo(path);
	};


	return {
		routerCur,
		routerArrayCur,
		openSubMenu,
		menuList,
		onMenu,
		message
	}
}