主导航切换
可切换并激活指定的主导航
vue
<script setup lang="ts">
import useSettingsStore from "@/store/modules/settings";
import useMenuStore from "@/store/modules/menu";
const settingsStore = useSettingsStore();
const menuStore = useMenuStore();
const menu = useMenu();
function switchTo() {
menu.switchTo(
menuStore.actived + 1 < menuStore.allMenus.length
? menuStore.actived + 1
: 0
);
}
</script>
<template>
<p>该特性只有在导航模式为 side 和 head 时生效。</p>
<el-button
:disabled="!['side', 'head'].includes(settingsStore.settings.menu.menuMode)"
@click="switchTo"
>
切换下一个
</el-button>
</template>