feat: 集成全屏功能

This commit is contained in:
张传龙 2022-05-10 17:18:04 +08:00
parent 4d6a58bfc8
commit 2338ded165
2 changed files with 22 additions and 6 deletions

View File

@ -17,4 +17,7 @@ export { default as IconMenuTable } from '~icons/mdi/table'
export { default as IconMenuCollapse } from '~icons/mdi/format-indent-decrease' export { default as IconMenuCollapse } from '~icons/mdi/format-indent-decrease'
export { default as IconMenuExpand } from '~icons/mdi/format-indent-increase' export { default as IconMenuExpand } from '~icons/mdi/format-indent-increase'
export { default as IconFullscreen } from '~icons/ant-design/fullscreen-outlined'
export { default as IconFullscreenExit } from '~icons/ant-design/fullscreen-exit-outlined'
export { default as IconLogo } from './IconLogo.vue' export { default as IconLogo } from './IconLogo.vue'

View File

@ -1,21 +1,30 @@
<template> <template>
<n-dropdown :options="options" @select="handleSelect"> <div class="actions-wrapper">
<div class="avatar"> <n-icon mr20 size="18" style="cursor: pointer" @click="toggle">
<img :src="userStore.avatar" /> <IconFullscreenExit v-if="isFullscreen" />
<span>{{ userStore.name }}</span> <IconFullscreen v-else />
</div> </n-icon>
</n-dropdown> <n-dropdown :options="options" @select="handleSelect">
<div class="avatar">
<img :src="userStore.avatar" />
<span>{{ userStore.name }}</span>
</div>
</n-dropdown>
</div>
</template> </template>
<script setup> <script setup>
import { IconFullscreen, IconFullscreenExit } from '@/components/AppIcons'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { resetRouter } from '@/router' import { resetRouter } from '@/router'
import { usePermissionStore } from '@/store/modules/permission' import { usePermissionStore } from '@/store/modules/permission'
import { NOT_FOUND_ROUTE } from '@/router/routes' import { NOT_FOUND_ROUTE } from '@/router/routes'
import { useFullscreen } from '@vueuse/core'
const userStore = useUserStore() const userStore = useUserStore()
const router = useRouter() const router = useRouter()
const { isFullscreen, toggle } = useFullscreen()
const options = [ const options = [
{ {
@ -81,6 +90,10 @@ function switchRole() {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.actions-wrapper {
display: flex;
align-items: center;
}
.avatar { .avatar {
display: flex; display: flex;
align-items: center; align-items: center;